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 / .NET Framework / CLR / November 2006

Tip: Looking for answers? Try searching our database.

Determining if a directory is writeable

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Marco Shaw - 23 Nov 2006 17:28 GMT
Is there something built-in to .net to determine if a directory is writeable
by the current user?

I want to write a Windows Powershell script that needs to write to a
directory.  I can certainly do something in PSH to get the current user,
then determine if the ACLs will allow writing, but perhaps .net has a
one-liner?

I know I can also just use PSH to try to write to the dir, then retrive the
error value.  Still, wondering if there's a prettier solution...

Marco
Vadym Stetsyak - 24 Nov 2006 10:47 GMT
Hello, Marco!

Something tells me that solutions here, as you sad, are:
- write smth ( create a file ) and get exception if there is no access
- analyze ACLs

1-st IMO is faster.

MS> Is there something built-in to .net to determine if a directory is
MS> writeable
MS> by the current user?

MS> I want to write a Windows Powershell script that needs to write to a
MS> directory.  I can certainly do something in PSH to get the current
MS> user,
MS> then determine if the ACLs will allow writing, but perhaps .net has
MS> a
MS> one-liner?

MS> I know I can also just use PSH to try to write to the dir, then
MS> retrive the
MS> error value.  Still, wondering if there's a prettier solution...

MS> Marco

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
Phil Wilson - 27 Nov 2006 21:23 GMT
I suspect you won't find out unless you try to do it. For example, The ACLs
won't matter on Vista if the interactive user is an administrator but
running as a limited user. An attempt to write could cause an elevation
prompt that could then be denied.
Signature

Phil Wilson
[Microsoft MVP Windows Installer]

> Is there something built-in to .net to determine if a directory is
> writeable by the current user?
[quoted text clipped - 8 lines]
>
> Marco

Rate this thread:







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.