Re: Impersonate in ASP.NET and Server Timer - FileSystemWatcher

From: jdn (kingcrim@earthlink.net)
Date: 10/04/02


From: "jdn" <kingcrim@earthlink.net>
Date: Fri, 4 Oct 2002 16:54:27 -0500


How do you SetThreadToken in .NET?

jdn

"Willy Denoyette [MVP]" <willy.denoyette@pandora.be> wrote in message
news:#klYjp4UCHA.1976@tkmsftngp11...
> Peter ,
> When impersonating, the thread handling the request uses the impersonation
token, but the timer thread (from the threadpool) uses
> the process token. This is the normal behavior in windows since it's
introduction. If you want another thread to use the
> impersonation token, you must explicitly call 'SetThreadToken' using as
argument, the token obtained for the "Main" thread.
>
> Willy.
>
>
> "Peter Royers" <peter.royers@eds.com> wrote in message
news:b75201c25348$e116be30$3aef2ecf@TKMSFTNGXA09...
> > Hi,
> >
> > I am having a problem with the following scenario:
> > I have webapp where I am using impersonation (in
> > web.config) to run under the user's logged in credentials.
> > This works fine.
> > I have also added a Server Timer in the web page.
> > Whenever the elapsed event is called from this timer
> > class it runs under the aspnet account in stead of the
> > user's credentials. I noticed the same effect with the
> > filesystemwatcher.
> > Does anyone has an idea on how to resolve or explain this?
> > Thanks.
>
>



Relevant Pages

  • Re: Windows authentication for web service client??
    ... > Dim Response As System.Net.HttpWebResponse ... > make my http WEBDAV request here ... ... CredentialCache.DefaultCredentials will return the credentials that ... I have try the same approach using implicity impersonation, ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Windows authentication for web service client??
    ... >> Dim Response As System.Net.HttpWebResponse ... >> make my http WEBDAV request here ... ... CredentialCache.DefaultCredentials will return the credentials that ... > I have try the same approach using implicity impersonation, ...
    (microsoft.public.dotnet.framework.aspnet.webservices)
  • Re: Impersonate in ASP.NET and Server Timer - FileSystemWatcher
    ... "When you launch another thread, what identity does it run under?" ... the thread handling the request uses the impersonation ... >>> web.config) to run under the user's logged in credentials. ... >>> I have also added a Server Timer in the web page. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Impersonate() & ASPNET worker threads. Bug or undocumented feature?
    ... > impersonation on in web.config. ... > In my oppinion ASPNET worker process even in one request scope switches ... > The anonymous access for application should be forbidden, ... that ASPNET worker might switch threads while executing ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: SetPassword access denied
    ... That said, I think one thing worth pointing out is that in both cases here, your code is supplying credentials to the DirectoryEntry constructor. ... the identity of the current thread (established either via impersonation or using the process token without impersonation) is NOT the account that is used for performing remote activities in the directory. ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.windows.server.active_directory)