WYSIWYG

http://kufli.blogspot.com
http://github.com/karthik20522

Friday, September 28, 2012

Handling Unhandled Exception Asp.NET MVC

Well, having unhandled exception is bad in the first place but displaying user a default IIS broken exception page or the yellow broken code page is even worse. Not a good user experience. But as all code/software there is always bugs and all ways a edge case that breaks unexpectedly. These unhandled expections can be handled in controller level in Asp.NET MVC. Following is a code snipped of handling errors and routing the user to a more user friendly error page.



In the above code, once the error is handled it's redirected to an Error Page. A user friendly error page such as this from clipthetrip.com

Labels: , ,