Multiple user impersonation

  • Thread starter Thread starter Tarun Harkinia
  • Start date Start date
T

Tarun Harkinia

Guest
I have an issue with .net impersonation, here I have a requirement like current login process have access to the source directory, while destination user is secure, now, I wish to place file under destination, so I must have to impersonate user while copy operation,

now, the issue is after the impersonation block, a code having access on destination, but source path could not be accessible, so operation is going to fail

Example -
Source:
User 1 has access on below path: c:\test\1.txt
User 2 doesn't have an access on below path: c:\test\

Destination:
User 1 doesn't have an access on below path: d:\test\
User 2 has access on below path: d:\test\

-- C# Sample code

WindowsIdentity idnt = new WindowsIdentity(Username, Password);
WindowsImpersonationContext context = idnt.Impersonate();
System.IO.File.Copy(srcPath1, desPath2, true);
context.Undo();

Now the question is - Is it possibe System.IO.File.Copy(srcPath1, desPath2, true); funcation can allow code to execute with user 1 and user 2 power?

user 1 and user 2 (multipe user) can allow opration for System.IO.File.Copy ?

Continue reading...
 
Back
Top