You can not, this is a part of the inside function call and you can not change it. Here is the function that make the redirect and its have the this.Request.Path
not the full url with the parameters.
internal bool RedirectToErrorPage(string url, CustomErrorsRedirectMode redirectMode)
{
try
{
if (string.IsNullOrEmpty(url))
{
return false;
}
if (this._headersWritten)
{
return false;
}
if (this.Request.QueryString["aspxerrorpath"] != null)
{
return false;
}
if (redirectMode == CustomErrorsRedirectMode.ResponseRewrite)
{
this.Context.Server.Execute(url);
}
else
{
if (url.IndexOf('?') < 0)
{
url = url + "?aspxerrorpath=" + HttpEncoderUtility.UrlEncodeSpaces(this.Request.Path);
}
this.Redirect(url, false);
}
}
catch
{
return false;
}
return true;
}
To say few more.
When you have reach at that error page you have lost control, meaning that you ether have a programming error, or some unhanding exception. That error is logged on your EventViewer, but you can also use the Application_Error
on the global.asax to personal log it and write it to your log file.
relative:
How to catch unhandled exceptions in an asp.net application?
How do I make a "generic error" page in my ASP.NET application so that it handles errors triggered when serving that page itself?