我正在尝试实现AcquireRequestState
我的应用程序的 Global.asax 中的事件,但是当我添加以下代码时,Visual Studio 2010 会警告我消息
'TestMe.Global.AcquireRequestState(object, System.EventArgs)' hides inherited member 'System.Web.HttpApplication.AcquireRequestState'. Use the new keyword if hiding was intended.
protected void AcquireRequestState(object sender, EventArgs e)
{
//Some code here
}
我的问题是,当 Application 类的其余方法如 Application_Start
时,为什么会隐藏基类实现? , Session_Start
还好吗?
是AcquireRequestState
在基类中声明,而其余方法只是仅在 Global.asax 类中声明的事件处理程序
最佳答案
我认为 Autowiring 事件名称应该是 Application_AcquireRequestState
:
protected void Application_AcquireRequestState(object sender, EventArgs e)
{
//Some code here
}
关于c# - 为什么 AcquireRequestState 隐藏 Inherited HttpApplication.AcquireRequestState 而 Application_Start 则不隐藏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8520290/