In .NET, is there a simple way to check whether the current user has access to create a file in a directory? Something equivalent to the C++ _access function, would be ideal.
I don’t want to use trial and error (create a dummy file and then delete it): apart from seeming hackish, other software is monitoring the directory in question for dropped files.
I don’t want to use System.DirectoryServices: looking at ACL’s, resolving group memberships and how permissions from different group memberships interact seems error prone and too hard. There must be a yeah-or-nay function somewhere, no?
Thanks in advance!
[edit] as a bonus, if it would work for a network share as well, that’d be cool.
1 Answer