C# 会议(开始及结束);会话结束于Global.asax.cs

C# 会议(开始及结束);会话结束于Global.asax.cs,c#,.net,asp.net-mvc,C#,.net,Asp.net Mvc,这两个事件处理程序属于哪个类的哪些事件 例如,Global.asax中的应用程序_BeginRequest通过命名约定注册到HttpApplication类的BeginRequest 在这3节课中,我找不到关于这2节课事件的任何信息: HttpApplication、HttpContext、HttpSessionState属于 这是旧文档,但如果从开始,您将看到可以订阅的事件是通过实现IHttpModule接口的类型公开的。查看的文档,您会发现实现IHttpModule)的内置类型: Class

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

例如,Global.asax中的应用程序_BeginRequest通过命名约定注册到HttpApplication类的BeginRequest

在这3节课中,我找不到关于这2节课事件的任何信息: HttpApplication、HttpContext、HttpSessionState属于

这是旧文档,但如果从开始,您将看到可以订阅的事件是通过实现
IHttpModule
接口的类型公开的。查看的文档,您会发现实现
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.
他们属于国家

这是旧文档,但如果从开始,您将看到可以订阅的事件是通过实现
IHttpModule
接口的类型公开的。查看的文档,您会发现实现
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.

为什么他们必须属于一个阶级?它们是ASP.NET运行时调用的神奇方法。它们必须以某种方式注册到类的事件中。@CodeCaster-它们不是神奇的。有一种特定的机制,您(或我)可以通过该机制注册运行时将以相同方式处理的模块。@Damien我的意思是ASP.NET进行反射以查找这些方法并连接事件处理程序。您不必自己注册事件。当然,它们是在某个类中实现的,但是您不必知道是哪一个。@CodeCaster-如果您想阅读事件的文档,了解它们是在什么时候被调用的,您就需要知道。在这里,我们经常会遇到一些不好的问题,人们没有阅读文档,但是如果您只是将global.asax事件处理程序视为“魔术”,您将不知道在哪里可以找到文档。为什么它们必须属于一个类?它们是ASP.NET运行时调用的神奇方法。它们必须以某种方式注册到类的事件中。@CodeCaster-它们不是神奇的。有一种特定的机制,您(或我)可以通过该机制注册运行时将以相同方式处理的模块。@Damien我的意思是ASP.NET进行反射以查找这些方法并连接事件处理程序。您不必自己注册事件。当然,它们是在某个类中实现的,但是您不必知道是哪一个。@CodeCaster-如果您想阅读事件的文档,了解它们是在什么时候被调用的,您就需要知道。在这里,我们经常会遇到一些糟糕的问题,人们没有阅读文档,但是如果您只是将global.asax事件处理程序视为“魔术”,您将不知道在哪里可以找到文档。