c# - Check user permissions -


this question has answer here:

i have application running in server, takes username , file path. idea check if user can read file (the target user is not same user running program).

so how check read permissions specific user ??

i can't take responsibility googled , answer james newton-king found here- how present credentials in order open file?


you want impersonate user have rights access file.

i recommend using class - http://www.codeproject.com/kb/cs/zetaimpersonator.aspx. hides nasty implementation of doing impersonation.

using (new impersonator("myusername", "mydomainname", "mypassword")) {   string filetext = file.readalltext("c:\test.txt");   console.writeline(filetext); } 

Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -