How can I redirect to another page from Application_Error
?
At present i am doing
Response.Redirect("~/Account/LogOn");
but i would like to do some thing like RedirectToAction()
Application_Error is not really a designed way to handle errors in MVC application.
The prefered ways are:
Some more links that can be helpful:
Also, I would recommend using ELMAH if you're not using it right now. You can get it as NuGet package.
HttpContext.Current.Response.RedirectToRoute(...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With