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
Post a Comment