The highlighted part stops the javascript erroring if the erorr message contains CRLF. (Which most of the custom error messages in the system I'm working with do.)
try
{
...
}
catch (Exception ex)
{
DBUtils.RollbackTrans();
bdyDetail.Attributes.Add("onload", "javascript:alert('" + ex.Message.Replace("\r\n", "\\n") + "')");
}
}
catch (Exception ex)
{
DBUtils.RollbackTrans();
bdyDetail.Attributes.Add("onload", "javascript:alert('" + ex.Message.Replace("\r\n", "\\n") + "')");
}
0 comments:
Post a Comment
I get a lot of comment spam :( - moderation may take a while.