我当前的错误处理 URL 看起来很丑:
http://localhost:65089/Error/NotFound?aspxerrorpath=/Foo
宁愿有这样的东西:
http://localhost:65089/Error/NotFound
网页配置代码
<system.web>
<customErrors mode="On" defaultRedirect="~/Error/Unknown">
<error statusCode="404" redirect="~/Error/NotFound" />
</customErrors>
错误控制器
public class ErrorController : Controller
{
//
// GET: /Error/
public ActionResult Unknown()
{
return View();
}
public ActionResult NotFound()
{
return View();
}
}
提前致谢!