Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / December 2005

Tip: Looking for answers? Try searching our database.

Directory access

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Bit Twiddler - 26 Dec 2005 21:58 GMT
Hi,

What is the *proper* way to determine if I have write-access to a given
directory?

Thanks!
BT
Frans Bouma [C# MVP] - 27 Dec 2005 09:05 GMT
> Hi,
>
> What is the proper way to determine if I have write-access to a given
> directory?

    Get first a DirectoryInfo object using:
DirectoryInfo di = new DirectoryInfo(@"c:\MyDir");

    then, call di.GetAccessControl() (or the overload).

        FB

Signature

------------------------------------------------------------------------
Get LLBLGen Pro, productive O/R mapping for .NET: http://www.llblgen.com
My .NET blog: http://weblogs.asp.net/fbouma
Microsoft MVP (C#)
------------------------------------------------------------------------

Bit Twiddler - 27 Dec 2005 16:10 GMT
DirectoryInfo.GetAccessControl() returns a DirectorySecurity object:

DirectoryInfo di = new DirectoryInfo(@"c:\MyDir");
DirectorySecurity ds = di.GetAccessControl();

Now I can call ds.AccessRightType, but I don't understand why this returns a
Type, instead of a mask representing the FileSystemRights enumeration.

If I could get those flags I could just check for
FileSystemRights.CreateFiles, etc.

Any pointers would be appreciated!

Thanks,
BT

>> Hi,
>>
[quoted text clipped - 7 lines]
>
> FB

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.