I want to transfer all unhandled exceptions to an error page in Asp.Net MVC. What is the way to handle the unhandled exceptions in Asp.net MVC? Is there anything like application_error?
That's what I'm looking for. Thanks!
yapiskan
2009-03-06 11:48:43
+1
A:
If you are using the standard setup, your controller(s) can do this by overriding one of the methods (proabably OnException
, but I don't have it handy to check). If you want all your controllers to share this logic, you can use a base-controller.
Alternatively, you can do this via filters (for example [HandleError]
). I don't know if there is a single global place for such logic, though.
Marc Gravell
2009-03-06 11:48:16