我试图实现一个类(让我们称之为CustomerConnection类)实现System.Web.HttpApplication接口。我试图实现两个事件Session_End中,以这种方式application_end事件在这个类:关于Session_End和Application_End方法在asp.net
public class CustomerConnection: System.Web.HttpApplication
{
protected void Session_End(object sender, EventArgs e)
{
HttpApplication application = (HttpApplication)sender;
HttpContext context = application.Context;
SqlConnection connection = context.Items[Database_Con] as SqlConnection;
connection.close();
}
protected void Application_End(object sender, EventArgs e)
{
HttpApplication application = (HttpApplication)sender;
HttpContext context = application.Context;
//someotherEvent
}
但似乎这些事件都没有得到既不结束应用程序或会话日志进行执行。
我应该如何让这些事件得到执行?这是否像我必须通知某些其他事件?
我刚刚创建了一个客户类的新对象。是否足以让这些事件得到执行或者我的方法根本错误?
请帮我
感谢预期