Vam*_*msi 2 c# asp.net inheritance
我正在尝试AcquireRequestState
在我的应用程序的Global.asax中实现事件,但是当我添加以下代码时,Visual Studio 2010会通过消息警告我
'TestMe.Global.AcquireRequestState(object,System.EventArgs)'隐藏继承的成员'System.Web.HttpApplication.AcquireRequestState'.如果要隐藏,请使用new关键字.
protected void AcquireRequestState(object sender, EventArgs e)
{
//Some code here
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,为什么是这个隐藏在基类实现时,应用类的其余的方法一样Application_Start
,Session_Start
都很好?
是AcquireRequestState
在基类中声明,而其余的方法是仅在Global.asax类中声明只是事件处理程序
我相信自动连接的事件名称应该是Application_AcquireRequestState
:
protected void Application_AcquireRequestState(object sender, EventArgs e)
{
//Some code here
}
Run Code Online (Sandbox Code Playgroud)