0

Does anyone know what the best way would be to deal with error pages using ASP.NET (not MVC) Routing?

I have routing set up and working well, however if I visit a page which does not exist i get the standard 404 error page.

I would like to know if there is a way to catch these errors using Routing using something like the following, obviously 404 would be replaced with the code given.

RouteTable.Routes.MapPageRoute("errors", "{*url}", "~/error.aspx");

Also using the above code messes up my existing routing, so I assume the {*url} catches all URL's.

Thanks in advance.

3
  • 2
    Your route definition seems ok. Note that it must be LAST in your route definitions : in MVC, this would lead to stackoverflow.com/a/14586192/1236044 Commented Apr 16, 2013 at 14:08
  • I ended up using httpErrors which got the error pages working. Commented Apr 24, 2013 at 13:16
  • Used similar to this post to get working. stackoverflow.com/questions/7729261/… Commented Jan 26, 2015 at 14:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.