Just use a route:
// We couldn't find a route to handle the request. Show the 404 page.
routes.MapRoute("Error", "{*url}",
new { controller = "Error", action = "404" }
);
Since this will be a global handler, put it all the way at the bottom under the Default route.
More Related Contents:
- MaxJsonLength exception in ASP.NET MVC during JavaScriptSerializer
- How to make a catch all route to handle ‘404 page not found’ queries for ASP.NET MVC?
- Error Handling in ASP.NET MVC
- How can I have lowercase routes in ASP.NET MVC?
- How do I route a URL with a querystring in ASP.NET MVC?
- Is there an ASP.NET MVC HtmlHelper for image links?
- Intermittent asp.net mvc exception: “A public action method ABC could not be found on controller XYZ.”
- Howto allow “Illegal characters in path”?
- MVC 2 AreaRegistration Routes Order
- Including hash values in ASP.NET MVC URL routes
- ASP.NET MVC – Pass array object as a route value within Html.ActionLink(…)
- What is an MVC child action?
- Including an anchor tag in an ASP.NET MVC Html.ActionLink
- MVC3 unobtrusive validation group of inputs
- MVC Razor @foreach
- How to fix: Handler “PageHandlerFactory-Integrated” has a bad module “ManagedPipelineHandler” in its module list
- Is it possible to create a generic @helper method with Razor?
- Razor actionlink autogenerating ?length=7 in URL?
- How to remove ASP.Net MVC Default HTTP Headers?
- DataAnnotations validation (Regular Expression) in asp.net mvc 4 – razor view
- How to redirect HTTP to HTTPS in MVC application (IIS7.5)
- RenderAction RenderPartial
- Can I pass an anonymous type to my ASP.NET MVC view?
- How to create file and return it via FileResult in ASP.NET MVC?
- How do I prevent multiple form submission in .NET MVC without using Javascript?
- Accept comma and dot as decimal separator [duplicate]
- Must ASP.NET MVC Controller Methods Return ActionResult?
- Is it possible to create a Logon System with ASP.NET MVC but not use the MembershipProvider?
- CS0234: Mvc does not exist in the System.Web namespace
- ASP.Net WebAPI area support