Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Dim DirInfo As IO.DirectoryInfo = DriveInfo.RootDirectory

If I get into a protected system folder like "System Volume Information" in the root of drive, I get System.UnauthorizedAccessException.

So how can I check DirInfo to prevent this exception?

Thanks.

  • Administrators
Posted
Most of the system protected folders are marked as both hidden and system - it might be worth checking these attributes before attempting to access the folder. Alternatively you could just wrap the access in a try...catch block and handle the UnauthorizedAccessException when it occurs.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...