In my ASP.NET web application, I have defined custom error pages in my web.config file as follows:
<customErrors mode="On" defaultRedirect="~/default.html">
<error statusCode="404" redirect="~/PageNotFound.html" />
</customErrors>
In the case of a 404 error, my site redirects to the default.html
page, but it passes "aspxerrorpath" as a query string parameter to the custom error page as follows:
http://www.example.com/default.html?aspxerrorpath=/somepathcausederror/badpage.aspx
I don't want that behavior. I want the redirect URL to simply read:
http://www.example.com/default.html
Is there a way to achieve this?
question from:
https://stackoverflow.com/questions/4222226/how-to-prevent-aspxerrorpath-being-passed-as-a-query-string-to-asp-net-custom 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…