PC Review


Reply
Thread Tools Rate Thread

How do I get directory permissions?

 
 
=?Utf-8?B?TGVlIEhvbHNlbmJlY2s=?=
Guest
Posts: n/a
 
      8th Aug 2004
hi,

i am reading the directory structure into a treeview. when i select a new
drive and do not have access to an existing folder; i get an acess denied -
System.UnauthorizedAccessException error. how would i check for that in the
code.

i have tried this below, but i still get the error. any help ?
If Directory.GetDirectories(subDir).IsReadOnly = True Then
'do nothing
Else
If Directory.GetDirectories(subDir).Length <> 0
Then
subNode.Nodes.Add("")
End If

End If
 
Reply With Quote
 
 
 
 
=?Utf-8?B?QmhhcmF0IEJpeWFuaQ==?=
Guest
Posts: n/a
 
      9th Aug 2004
Hi Lee,

try this.

DirectoryInfo [] subdir=null;
try
{
subdir=Directory.GetDirectories(subDir);
}
catch(Exception ex)
{
//handle exception
}
if(subdir!=null)
{
//iterate thru subdirectories array.
}

---
Bharat Biyani ((E-Mail Removed))
http://www.orcim.com

"Lee Holsenbeck" wrote:

> hi,
>
> i am reading the directory structure into a treeview. when i select a new
> drive and do not have access to an existing folder; i get an acess denied -
> System.UnauthorizedAccessException error. how would i check for that in the
> code.
>
> i have tried this below, but i still get the error. any help ?
> If Directory.GetDirectories(subDir).IsReadOnly = True Then
> 'do nothing
> Else
> If Directory.GetDirectories(subDir).Length <> 0
> Then
> subNode.Nodes.Add("")
> End If
>
> End If

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory permissions from VBA Eric Dreksler Microsoft Access Security 0 16th Jul 2004 12:26 AM
Re: Directory Permissions... Thomas A. Rowe Microsoft Frontpage 0 25th Jun 2004 05:13 PM
How To set Directory Permissions in VB.NET Costa, Frank Microsoft VB .NET 0 9th Jan 2004 01:48 PM
directory permissions Cecile Windows XP Security 1 21st Dec 2003 11:16 PM
Directory Permissions Bob Microsoft Windows 2000 Security 2 6th Dec 2003 10:52 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:14 PM.