Re: Copy files over a network share

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"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



.



Relevant Pages

  • Re: help: ts gateway keeps rejecting user credential
    ... i am not using saved credentials. ... I checked NPS and gateway log, ... see a buch of device redirection options. ... When the user credentials are ...
    (microsoft.public.windows.terminal_services)
  • Re: krbtgt failure code 0x12
    ... logged onto two computers and not logging off and back on to one of them ... figure out which service or program on her usual computer was causing the ... > by old user credentials being used from a user still logged onto another ...
    (microsoft.public.win2000.networking)
  • Re: How to get rid of AYGShell?
    ... Ouch, you mean that everybody has to login everytime now, or that some ... Searching through Help is like looking for a needle in a haystack, ... If the user selects the Save Credentials check box ... and Secur32.lib is present on the system, the user credentials will be saved ...
    (microsoft.public.windowsce.platbuilder)
  • Re: Encapsulating and Securing Pre-canned ADSI calls
    ... The OS will protect the credentials ... You could also set up the process account to use a specific admin identity ... Your business logic security layer ... > 1) Have the API obtain credentials of the user with admin rights in AD, ...
    (microsoft.public.dotnet.security)
  • Re: VB6 & Active Directory
    ... there is a LogonUser API. ... Can it be used with AD credentials? ... understood him to want to validate a given username + password pair ... A VB6 app must integrate with AD, ...
    (microsoft.public.vb.general.discussion)