相关疑难解决方法(0)

Global.asax魔术功能

在Visual Studio中创建ASP.NET Mvc项目时,将创建Global.asax&Global.asax.cs.在这个.cs文件中,您将找到标准Application_Start方法.

我的问题如下,如何调用此函数?因为它不是覆盖.所以我的猜测是这个方法名称是按照惯例.该Application_Error方法也是如此.

我想知道这些方法的钩子在哪里.因为我编写这些方法(不覆盖它们),我在MSDN中找不到任何关于它们的文档.(我找到了这个页面,但它只是告诉你挂钩Error事件并显示一个Application_Error(object sender, EventArgs e)但不是如何链接事件和方法.)

//Magicly called at startup
protected void Application_Start() 
{
    //Omitted
}

//Magicly linked with the Error event
protected void Application_Error(object sender, EventArgs e)
{
    //Omitted
}
Run Code Online (Sandbox Code Playgroud)

c# asp.net error-handling asp.net-mvc

27
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net ×1

asp.net-mvc ×1

c# ×1

error-handling ×1