"John Varouxis" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi all,
>
> I want to copy files residing in a network shared folder, but I have to
pass
> different user credentials than the executing user. How can I accomplish
> this. The System.IO.File.Copy overloaded methods don't accept credentials
in
> any form.
>
> Thanx in advance,
> Yannis
>
Hi,
I think you'll have to use native API to accomplish this. You have to call
LogonUser API and then impersonate. There is a sample in MSDN, check
WindowsIdentity.Impersonate Method in System.Security.Principal namespace.
I have once used WNetUseConnection API to map drive with different
credentials and then access it (as an alternative method).
Regards,
Goran
|