Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-mvc/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net mvc HttpApplication.User.Identity在哪里更新?_Asp.net Mvc_Forms Authentication_Security - Fatal编程技术网

Asp.net mvc HttpApplication.User.Identity在哪里更新?

Asp.net mvc HttpApplication.User.Identity在哪里更新?,asp.net-mvc,forms-authentication,security,Asp.net Mvc,Forms Authentication,Security,这个问题看似重复,但并没有得到详细的回答。 至少我不相信是这样 答案是 FormsAuthentication.SetAuthCookie 但我反编译了System.Web.Security FormsAuthentication类。 它调用GetAuthCookie并将其添加到响应中 当会话Cookie被发现时,我期待它在下一个请求中出现,而不是在FormsAuthentication中,如“正确答案”所述。 我搜索了完整的反编译源代码,但没有找到IPrincipal的引用。 有些人真的知

这个问题看似重复,但并没有得到详细的回答。 至少我不相信是这样

答案是

FormsAuthentication.SetAuthCookie
但我反编译了System.Web.Security FormsAuthentication类。 它调用GetAuthCookie并将其添加到响应中

当会话Cookie被发现时,我期待它在下一个请求中出现,而不是在FormsAuthentication中,如“正确答案”所述。 我搜索了完整的反编译源代码,但没有找到IPrincipal的引用。 有些人真的知道吗? 我可以用和事件触发此过程吗。? 我注意到诸如

AuthenticateRequest

AuthenticateRequest
它是在事件
AuthenticateRequest
中设置的,请参阅
FormsAuthenticationModule.oneter
,它通过
FormsAuthenticationModule.Init
绑定到
AuthenticateRequest
。如果要覆盖此标识,您只需自己设置
HttpContext.User

它是在事件
AuthenticateRequest
中设置的,请参阅
FormsAuthenticationModule.oneter
,它通过
FormsAuthenticationModule.Init
绑定到
AuthenticateRequest
。如果要覆盖此标识,您只需自己设置
HttpContext.User

谢谢Lukas,这就是我在SauthenticationModule中查找的内容。我将研究直接访问HttpContext.userThank Lukas的方法,这正是我在寻找的身份验证模块。我将研究对HttpContext.User的直接访问