Re: DirectoryNotFound when impersonating

From: Willy Denoyette [MVP] (willy.denoyette@pandora.be)
Date: 09/08/02


From: "Willy Denoyette [MVP]" <willy.denoyette@pandora.be>
Date: Sun, 8 Sep 2002 10:48:34 +0200


Did you get the token from IIS or did you call "LogonUser"?
If you are impersonating the IIS token, you can't use this impersonation token to access a remote resource.
You have two options to solve this issue:

- Use "LogonUser" to create a new Logon session for the file server "admin".
- Configure your servers and accounts to use Kerberos delegation.

Willy.

"Roger Wolfson" <rogerw7979@yahoo.com> wrote in message news:er$rUgtVCHA.3740@tkmsftngp08...
> My aspx page has a link "Delete", which deletes a directory of temp files
> from a server.
>
> I wanted to do this in a separate thread, and have used Impersonate() to set
> the principal of that thread to be a user who is an admin on the fileserver
> I'm deleting from.
>
> System.Security.Principal.WindowsIdentity.GetCurrent() , in that thread,
> shows that I am who I want to be.
>
> However, all directory commands to a different machine result in a
> DirectoryNotFoundException.
>
> (This is in C#, by the way)
>
> System.IO.Directory.Exists("\\\\myDebuggingMachine\\c$") works fine (==true)
> but
> System.IO.Directory.Exists("\\\\myOtherServer\\c$") becomes false as soon as
> I impersonate. Even after I impersonate,
> System.Security.Principal.WindowsIdentity.GetCurrent().IsAuthenticated ==
> true. (using NTLM)
>
> Am I hitting a difference between process-level and thread-levels tokens?
> Whatever my problem is, it seems to be similar to what someone else asked
> here:
>
> http://www.dotnet247.com/247reference/msgs/21/109048.aspx
>
> Thanks for any suggetsions anyone can offer.
>
>



Relevant Pages


Quantcast