asp.net - ASP .NET: Thread.CurrentPrincipal is lost when customErrors contains redirectMode="ResponseRewrite" -


i setup custom principal in 1 of modules handles authentication_request. set httpcontext.user. sets httpcontext.user , thread.currentprincipal. when error occurs , customerrors section contains "responserewrite", thread.currentprincipal reset generic principal on aspx error page., httpcontext.user still contains custom principal. not happen if customerrors section contains "responseredirect". expected behavior?

i suspect server spinning separate thread execute error page. might able reset (thread.currentprincipal) putting following global.asax.

  protected void application_authenticaterequest(object sender, eventargs e) {         thread.currentprincipal = httpcontext.current.user;   } 

this line insure both in sync on each request application.


Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -