I am stuck on this issue.
I have a UNC share, I know account information that has full access, but it does not have access to my local system. I can access the remote UNC with:
var token = default(IntPtr); var context = default(WindowsImpersonationContext); LogonUser(_config.Username, _config.Domain, _config.Password, 2, 0, out token); context = WindowsIdentity.Impersonate(token); //TODO :: System.IO operations File.Copy("remote-unc-path","local-path",true); // Exception : Access is denied. context.Undo(); CloseHandle(token);
But I canβt access my local system during the impersonation because the account does not have access to it.
How to copy a file in this situation? Do I need to use something like a buffer and enable / disable impersonation?
Debot source share