public void HandleError(Exception ex) { // See BZ 6662 if (!(ex is System.Threading.ThreadAbortException)) { if (CswNbtResources != null) { CswNbtResources.AnErrorOccurred = true; CswNbtResources.logError(ex); // Display the error in the ErrorBox if (CswNbtResources.ConfigVbls.getConfigVariableValue("displayerrorsinui") != "0") { string Title; string Message; if (ex is CswDniException) { Title = "Error: " + ((CswDniException)ex).MsgFriendly; Message = ((CswDniException)ex).MsgEscoteric; } else { Title = "Error: An internal error occurred."; Message = ex.Message; } Message += "<br/>Time: " + DateTime.Now.ToString(); Message += "<br/>Stack Trace: <br/>" + ex.StackTrace.Replace("\n", "<br/>\n") + "<br/><br/>"; //Title = DateTime.Now.ToString() + ": " + Title; ErrorBox.addMessage(Title, Message); } } //if (Session["errors"] == null) //{ // Session.Add("errors", ex.Message); //} //else //{ // Session["errors"] = Session["errors"].ToString() + "|" + ex.Message; //} if (ex.InnerException != null) { HandleError(ex.InnerException); } } else { throw ex; } Master.HandleAfterError(ex); }