I'm working on some error handling in my MVC app, and I'd like to change asperrorpath
to something that doesn't give away the fact that I'm using .NET... something like path
Can anyone give me some direction on how to change that out?
I'm working on some error handling in my MVC app, and I'd like to change asperrorpath
to something that doesn't give away the fact that I'm using .NET... something like path
Can anyone give me some direction on how to change that out?
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.
<error statusCode="403" redirect="NoAccess.htm" />
By supplying custom query string, your aspxerrorpath won't show up.
Check the original answer from this link: how to prevent “aspxerrorpath”
Just add dummy query string to your .htm pages as below.
<customErrors mode="On" defaultRedirect="errorpage.htm?error=1" >
<error statusCode="404" redirect="filenotfound.htm?error=1" />
</customErrors>
Check with fiddler, the asperrorpath query string does not appear anymore and referrer of errorpage.htm is completely clean.