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.
?asperrorpath=http... whereby everyone knows I'm using .net (not saying it's a bad thing). I'd just like to change the item to ?go=http.... Which I've already done. I'll post my solution later in the day.On (or RemoteOnly) customError but don't define any 404 redirection etc in the web.config, the "{*url}" will catch it. I am using MVC 3. Not sure about previous version. I will never get the ?asperrorpath=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”
redirect="~/?" in the web.config, your URL will look like http://localhost:51437/? - which is sort of ugly and may not meet your project's requirements.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.
.cshtml page instead of a normal HTML page? The MVC framework uses .cshtml files by default. Also, what if you have attribute-based routing set up?