Session_Start& Global.asax.cs中的Session_End

时间:2017-11-29 08:25:33

标签: c# .net asp.net-mvc

这两个事件处理程序属于哪个类的事件?

例如 Global.asax 中的 Application_BeginRequest 通过命名约定注册到HttpApplication类的BeginRequest。

关于这2个会话事件,我在这3个课程中找不到任何内容: HttpApplication HttpContext HttpSessionState

1 个答案:

答案 0 :(得分:4)

他们属于SessionStateModule

这是旧文档,但如果从Using Modules with the Global.asax File开始,您将看到可以订阅的事件由实现IHttpModule接口的类型公开。查看that interface的文档,您会发现实现IHttpModule的内置类型:

Class                         Description
DefaultAuthenticationModule   Insures that an Authentication object is present in the context. This class cannot be inherited.
FileAuthorizationModule       Verifies that the remote user has NT permissions to access the file requested. This class cannot be inherited.
FormsAuthenticationModule     Enables ASP.NET applications to use forms authentication. This class cannot be inherited.
PassportAuthenticationModul   Provides a wrapper around PassportAuthentication services. This class cannot be inherited.
SessionStateModule            Provides session-state services for an application.
UrlAuthorizationModule        Provides URL-based authorization services for allowing or denying access to specified resources. This class cannot be inherited.
WindowsAuthenticationModule   Enables ASP.NET applications to use Windows/IIS authentication. This class cannot be inherited.