ASP.NET MVC Error Handling - Remove aspxerrorpath ASP.NET MVC Error Handling - Remove aspxerrorpath asp.net asp.net

ASP.NET MVC Error Handling - Remove aspxerrorpath


Add redirectMode="ResponseRewrite" to the customErrors section. That worked for me.


my wprk around is using

route.MapRoute("NotFound", "{*url}", new {controller = "Home", action = "NotFound"})

At the bottom most, which I have NotFound action in HomeController.It will simply catch all other urls.


The are many ways you can solve your problem. It depends what you want.

  1. You can edit section in your web.config And write default link for redirecting on error and also specify different links for different error like <error statusCode="403" redirect="NoAccess.htm" />
  2. You can use HandleError attribute for your Controller/Actions. You can read about it here.