Use a try/catch block and in the catch use a Response.Redirect(“yourerrorpage.aspx?Msg=” + “your message here.”);
EXAMPLE: try { … } catch (Exception ex) { Response.Redirect(@”generalerror.aspx?Msg=” + PageUtils.Clean(ex.Message)); }
/// /// Removes any embedded newline characters from a string ///
/// The string to be cleaned /// A string without newline characters. public static string Clean(string text) { string buf = text; if (text.Length > 1000) { buf = Clean(text.Substring(0, 1000), Constants.CRLF); } else { buf = Clean(buf, Constants.CRLF); }
return buf; }
You must be logged in to post a comment.
Comments
Leave a comment Trackback