I am using File.Copy
to copy the file from my local system to REMOTE Server using below code.
But its giving me error:
Either a required impersonation level was not provided, or the provided impersonation level is invalid.
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
WindowsIdentity idnt = new WindowsIdentity("username", "password");
WindowsImpersonationContext context = idnt.Impersonate();
File.Copy("LocalFilepath", Path.Combine(@"\\servername\\c\\Folder1\\EmpDetails.xml"), true);
Thanks Gaby , i have tried the platinumdogs.me/2008/10/30/… but now i am getting Exception in copying file saying that -Could not find file "LocalFile" - I have admin rights on Remote Server also.