mvc中的程序错误之404(一),无法找到资源

运行程序的时候,如果,没有在controller的基础上运行的话会出错,
所以,为了解决这个错误,下面这个方法就是为了避免出现这样的错误,在文件global.asax中添加以下方法:

protected void Application_Error(object sender, EventArgs e)
{
  Exception LastError = Server.GetLastError();
  Response.Redirect("/error.htm");
}

自己添加error.html页面,随便写点东西即可

posted on 2013-05-09 15:55  福气满满好运连连  阅读(489)  评论(0编辑  收藏  举报