看似重复的问题,但没有得到详细的回答。好吧,至少我不相信它是。
Who sets the IsAuthenticated property of the HttpContext.User.Identity
答案是
FormsAuthentication.SetAuthCookie但是我反编译了System.Web.Security FormsAuthenication类。它调用GetAuthCookie并将其添加到响应中。
我期待它在下一次请求时,会话Cookie被发现,而不是在FormsAuthentication中,如“正确答案”所述。我搜索了完整的反编译源代码,没有找到IPrincipal的引用。真的有人知道吗?我是否可以使用和事件触发此过程。?我注意到像这样的事件
AuthenticateRequest和AuthorizeRequest
发布于 2012-12-09 06:56:38
它是在event AuthenticateRequest中设置的,请参阅通过FormsAuthenticationModule.Init绑定到AuthenticateRequest的FormsAuthenticationModule.OnEnter。如果想要覆盖此标识,您可以简单地自行设置HttpContext.User。
https://stackoverflow.com/questions/13775660
复制相似问题