c# - Check user permissions -
this question has answer here:
- checking file/folder access permission 3 answers
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
Post a Comment