Can someone guide me about best practices about exception handling in a legacy asp.net MVC app?
I am working with a legacy asp.net MVC app where errors are not properly handled, I know there are multiple ways to handle errors in .net, there's try-catch, overriding OnExcpeiton method, HandleError attribute, global exception handling, Application_error method in Global.asax file on legacy app etc.
In order to provide good user experience where should I start? I am also confused on how MVC app works because out of the box it handles errors for example, when I am running the app locally if the app encounters the error it shows the infamous yellow screen of death but on production it straight up redirects the user to index page and this is an issue cause this app uses a lot of modals and if things break the index page will be rendered in the modal which can cause panic from end users making which ultimately makes them raise and escalate tickets.
I not sure what would be the best approach in this case, can someone help me? typically what is the best way to handle errors gracefully in MVC app and where can I get more information regarding this?
Please remember that this is a legacy MVC app that was written in 2008 and the UI for it was revamped in 2017, Thanks for reading.
Posted May 7, 2025, 2:31 PM UTC