Re: Copy files over a network share
- From: "Goran Sliskovic" <gsliskov@xxxxxxxxx>
- Date: Tue, 26 Jul 2005 16:53:22 +0200
"John Varouxis" <varj@xxxxxxxxxxxxxx> wrote in message
news:%23asfAfdkFHA.3936@xxxxxxxxxxxxxxxxxxxxxxx
> 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
.
- References:
- Copy files over a network share
- From: John Varouxis
- Copy files over a network share
- Prev by Date: call c# written dll function from command line
- Next by Date: 1.1 and 2.0 Framework in production enviroment
- Previous by thread: Copy files over a network share
- Next by thread: Re: Copy files over a network share
- Index(es):
Relevant Pages
|