You don't need Delegation for this to work.
Just call "LogonUser" with LOGON32_LOGON_NETWORK_CLEARPASSWORD on Windows2000.
or Call "LogonUser" with LOGON32_LOGON_BATCH followed by a call to 
"ImpersonateLoggedOnUser", don't use
"WindowsIdentity.Impersonate" as it calls "SetThreadToken",  which doesn't accept a 
Direct token as obtained from
"LogonUser"

Willy.


----- Original Message -----
From: "Csaba Gero" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 23, 2002 11:49 AM
Subject: Re: [ADVANCED-DOTNET] Copy a file while impersonating - what am I doing wrong


AFAIK this is only true for Windows NT 4. In Windows 2000 you can have a
delegation level impersonation token. To get one of these the server
account has to have the "trust for delegation" flag set in the AD.

Csaba

> -----Original Message-----
> From: Steve Johnson [mailto:[EMAIL PROTECTED]]
> Posted At: Friday, May 17, 2002 6:45 PM
> Posted To: dotnet
> Conversation: Re: Copy a file while impersonating - what am I doing
wrong
> Subject: Re: Copy a file while impersonating - what am I doing wrong
>
> > I have a Windows form app. It switches identity by calling
LogonUser,
> then
> > calls WindowsIdentity.Impersonate. While I'm impersonating, I'd like
to
> copy
> > a file from my machine to another machine in the domain via
> > system.IO.File.Copy. The impersonation works just fine, however, the
> copy
> > fails with "access to the path <target path> is denied" exception.
>
>
> In short, you can't access network resources while impersonating.
>
> The problem is that you have no network credentials with an
> impersonation token.  The remote machine must have credentials to
> authenticate you and this requires a primary token.
>
> --
> Steve Johnson
> 3t Systems

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to