“A specified logon session does not exist. It may already have been terminated.” when trying to copy a file using WindowsIdentity.Impersonate
问题 I am trying to copy a file from sharepoint to a unc path. I am using the following code: var id = new WindowsIdentity("administrator@mysite.com"); var p = new WindowsPrincipal(id); var wic = id.Impersonate(); File.Move(oldName, newName); wic.Undo(); oldname is C:\test.txt newName is \\server\folder\test.txt I am getting the error A specified logon session does not exist. It may already have been terminated. How do I go about removing this error OR copy a file from A to B(UNC path) using