简体   繁体   中英

In ASP.NET MVC4, where has application_error gone?

In MVC3, there was an Application_Error event handler in Global.asax.cs

MVC4 does not have this event handler. Is there new functionality that is used to handle event errors like this in MVC4?

Yes, it does have an Application_Error event, but like other events you have to actually create it yourself. Just add it to global.asax

void Application_Error(object sender, EventArgs e)
{
    ....
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM