Impersonate a user

  • Thread starter Thread starter Sorin Sandu
  • Start date Start date
S

Sorin Sandu

I am trying to impersonate the windows account in code like in
http://support.microsoft.com/default.aspx?scid=kb;en-us;306158 and then all
aspx pages to run on this new account (ACL on files is only for this
account).
But after the first page when I impersonate it and I redirect to another
page the account reverse to original.
How can I do to maintain impersonation but in code not in web.config.
 
you need to understand that http protocol is stateless. while ASP.NET tries
to simulate statefulness, that's just all fake. when you redirect, the
current request is terminated, and the client is instructed by the server to
send another request for the new page, all the previous state, including your
impersonation is lost because the request is handled by a completely new
thread. you will need to impersonate again on the new thread.
 
Back
Top