哪里是FormsAuthenticationModule注册? [英] Where is FormsAuthenticationModule registered?

查看:171
本文介绍了哪里是FormsAuthenticationModule注册?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在我试图找出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 the InitModulesCommon private method which is calling the Init 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆