I've added the following to my web.config to redirect a user to a custom error page instead of the default
Server Error in '/' Application.
error message.
The user get's redirected to error.html?aspxerrorpath=/paymentservices.svc
Is there a way to remove the ?aspxerrorpath=/paymentservices.svc part?
web.config:
<system.web>
<customErrors defaultRedirect="~/ErrorPages/error.html"
mode="On" xdt:Transform="Replace">
<error statusCode="500" redirect="~/ErrorPages/error.html"/>
<error statusCode="404" redirect="~/ErrorPages/error.html"/>
</customErrors>
</system.web>
A cheap way is to just add your own query string to end of the error - it should overwrite the "default" one. Even an empty string should work.
<error statusCode="500" redirect="~/ErrorPages/error.html?"/>
Or you could add your own error handling to Application_Error in Global.ascx
You could try rewriting the response
<customErrors mode="On" redirectMode="ResponseRewrite" >
....
</customErrors>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With