In the following line
Response.Redirect(String.Format("~/Error/Index/?message={0}", exception.Message));
You need to url encode the message.
Response.Redirect(String.Format("~/Error/Index/?message={0}", Server.UrlEncode(exception.Message)));
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi
protected void Application_Error(object sender, EventArgs e)
{
Exception exception = Server.GetLastError();
if (exception != null)
{
HttpException httpException = null;
if (exception is HttpException)
{
httpException = exception as HttpException;
}
Response.Clear();
Server.ClearError();
Response.Redirect(String.Format("~/Error/Index/?message={0}", exception.Message));
}
}
Thanks
In the following line
Response.Redirect(String.Format("~/Error/Index/?message={0}", exception.Message));
You need to url encode the message.
Response.Redirect(String.Format("~/Error/Index/?message={0}", Server.UrlEncode(exception.Message)));
Hi @Jagjit Saini ,
Redirect URI cannot contain newline characters.
Where is the newline characters? I have tried the codes of Response.Redirect and it works fine.
You could check which lines have errors.
Best regards,
Yijing Sun
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.