MVC错误处理
Global.asax.cs中添加如下的代码:
protected void Application_Error(Object sender, EventArgs e) { Exception lastError = Server.GetLastError(); if (lastError != null) { Response.StatusCode = 500; Response.WriteFile("~/error/error.htm"); Server.ClearError(); } }