mvc中的程序错误之404(一),无法找到资源
运行程序的时候,如果,没有在controller的基础上运行的话会出错,
所以,为了解决这个错误,下面这个方法就是为了避免出现这样的错误,在文件global.asax中添加以下方法:
protected void Application_Error(object sender, EventArgs e)
{
Exception LastError = Server.GetLastError();
Response.Redirect("/error.htm");
}
自己添加error.html页面,随便写点东西即可
作者:魔女小溪
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利.