c# - Creating Windows Folders using impersonation -



c# - Creating Windows Folders using impersonation -

i'm trying create folder using credentials of limited admin business relationship supplied encrypted .config file- right code running under assumption user has no access these directories, unauthorizedexception thrown, when given access code otherwise works, can't compromise our security. know how username / password out of encrypted file already, i'm not sure library or syntax should utilize impersonate; code:

//set cursor string activedir = "\\\\department\\shares\\users\\"; //create directory userid folder name string newpath = system.io.path.combine(activedir + userid); system.io.directory.createdirectory(newpath);

so need way supply credentials i'm @ loss- i've been using system.directoryservices.accountmanagement , pricipalcontext supply username/password making changes active directory... need utilize similar library create changes file system? help appreciated, thanks!

i think impersonate user temporarily thread performing action. seems can done p/invoke. have @ this example.

using (var impersonation = new impersonateduser(decrypteduser, decrypteddomain, decryptedpassword)) { directory.createdirectory(newpath); }

c# c#-4.0 filesystems

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -