I have a folder on my computer and I used DirectoryInfo to get all the files in this folder. But it uses my user account. I have to use the permissions of another user account, and I need to know if this other account can read and list files in this folder.
Here is the code I wrote to get the files:
DirectoryInfo Folder = new DirectoryInfo(folderName);
FileInfo[] Files = Folder.GetFiles(search, SearchOption.TopDirectoryOnly);
I was expecting a way to do something like this:
DirectoryInfo Folder = new DirectoryInfo(folderName, UserCredentials);
And if this user does not have permission, this line excludes or can verify the rights of the user.
thanks...
source
share