哪里是FormsAuthenticationModule注册? [英] Where is FormsAuthenticationModule registered?
问题描述
现在我试图找出MVC认证中详细介绍了如何asp.net工作。据我了解究竟FormsAuthenticationModule检查cookie,并填补了HttpContext.User中。但我找不到在哪里FormsAuthenticationModule注册了我的申请?
但我找不到在哪里FormsAuthenticationModule注册了我的申请?
块引用>它是由ASP.NET运行时,当您设置自动注册
<身份验证模式=表单方式>
在你的web.config如果您有兴趣的细节,你可以看看ASP.NET源$ C $ c和更具体的
的HttpApplication
类和InitModulesCommon
如果你在你的web.config注册它是调用FormsAuthentication模块的初始化
方法私有方法。该FormsAuthentication模块本身,一旦注册,将认购到HTTP处理管道的
的AuthenticateRequest
事件,它将试图建立一个IPrincipal。将根据当前的HttpContext值在请求中发送的窗体身份验证cookie present。Now I'm trying to find out how asp.net mvc authentication works in details. As I understand exactly FormsAuthenticationModule checks cookie and fills up HttpContext.User. But I can't find where FormsAuthenticationModule is registered for my application?
解决方案But I can't find where FormsAuthenticationModule is registered for my application?
It's automatically registered by the ASP.NET runtime when you set
<authentication mode="Forms">
in your web.config.If you are interested in the details, you may take a look at the source code of ASP.NET and more specifically the
HttpApplication
class and theInitModulesCommon
private method which is calling theInit
method of the FormsAuthentication module if you registered it in your web.config.The FormsAuthentication module itself, once registered, will subscribe to the
AuthenticateRequest
event of the HTTP processing pipeline and it will attempt to build an IPrincipal into the current HttpContext based on the values present in the forms authentication cookie sent in the request.这篇关于哪里是FormsAuthenticationModule注册?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!