These forums are read-only and considered to be an archive. Please use the new Community for future interaction and posts.

Trapping path error

Is a there a way to handle the event of
"An error occured: Attempted to access a path and is not on the disk"?

Root folders are being created programatically and ocasionally they may not exist on the disk. In those cases I need to provide a customized message to the user.
Mauro 2/18/2009 6:19 PM
You can check the existence of the path and create the path if it not exists before loading the control in Page_Load method. Just reference GleamTech.IO.dll in your project and make use of our FolderInformation.CreatePath() method which creates all the folders in a given path at once. See below for an example usage:

C#:

if (!System.IO.Directory.Exists(rootFolderPath))
       GleamTech.IO.FolderInformation.CreatePath(rootFolderPath);


VB:

If Not System.IO.Directory.Exists(rootFolderPath) Then 
    GleamTech.IO.FolderInformation.CreatePath(rootFolderPath) 
End If 
Cem Alacayir 3/10/2009 4:19 AM