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.
- 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" />
- You can use HandleError attribute for your Controller/Actions. You can read about it here.