How can I Handler 404 errors without the framework throwing an Exception 500 error code?
相关问题
- Angular RxJS mergeMap types
- MVC-Routing,Why i can not ignore defaults,The matc
- Google Apps Script: testing doPost() with cURL
- How to instantiate Http service in main.ts manuall
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
相关文章
- C#使用http访问网络,有办法用指定网卡访问网络嘛?
- How to get a list of connected clients on SignalR
- How do you redirect to the calling page in ASP.NET
- Change color of bars depending on value in Highcha
- Is a unicode user agent legal inside an HTTP heade
- The program '[4432] iisexpress.exe' has ex
- ASP.Net MVC 4 Bundles
- How to get server path of physical path ?
throw new HttpException(404, "Resource Not Found");
http://jason.whitehorn.ws/2008/06/17/Friendly-404-Errors-In-ASPNET-MVC.aspx gives the following explanation:
Add a wildcard routing rule as your final rule:
Any request that doesn't match another rule gets routed to the Http404 action of the Error controller, which you also need to configure:
With MVC 3 you can return HttpNotFound() to properly return a 404.
Like this:
You can also override HandleUnknownAction within your controller in the cases where a request does match a controller, but doesn't match an action. The default implementation does raise a 404 error.