public void LogException(Exception ex, Nullable <Guid> sessionId, string userIP, string url, string additionalInfo, int exceptionObjectHash, int innerExceptionCount) { try { var exMessage = ex.Message; using (var connection = ConnectionFactory.GetConnection()) { var dalLogger = new ResellerClub.DataAccess.ExceptionLogger(ConnectionFactory.GetConnection()); if (ex.InnerException != null || innerExceptionCount > 0) { exMessage = ex.Message + Environment.NewLine + exceptionObjectHash.ToString() + "[" + innerExceptionCount.ToString() + "]"; } dalLogger.LogException(sessionId, userIP, exMessage, ex.StackTrace, url, additionalInfo); } if (ex.InnerException != null) { LogException(ex.InnerException, sessionId, userIP, url, additionalInfo, exceptionObjectHash, ++innerExceptionCount); } } catch (Exception excep) { XmlTraceWriter.TraceInfo("========================================================="); XmlTraceWriter.Trace(ex); XmlTraceWriter.Trace(excep); XmlTraceWriter.TraceInfo(Environment.NewLine + "UserIP:" + userIP + Environment.NewLine + "SessionID:" + sessionId + Environment.NewLine + "AdditionalInfo" + additionalInfo + Environment.NewLine); XmlTraceWriter.TraceInfo("========================================================="); } }
protected void Application_Error(object sender, EventArgs e) { return; Exception lastServerException = null; var url = HttpContext.Current.Request.Url.AbsoluteUri; try { Nullable <Guid> sessionId = null; lastServerException = Server.GetLastError(); // var logger = new ResellerClub.BusinessLogic.ExceptionLogger(); // logger.LogException(lastServerException, sessionId, Helper.GetIPAddress(), url, "", lastServerException.GetHashCode(), 0); } catch (Exception ex) { if (lastServerException != null) { XmlTraceWriter.TraceInfo("========================================================="); XmlTraceWriter.Trace(lastServerException); XmlTraceWriter.Trace(ex); XmlTraceWriter.TraceInfo("========================================================="); } else { XmlTraceWriter.Trace(ex); } } finally { var exceptionInErrorPage = false; try { Server.Execute("Error.aspx"); } catch (Exception ex) { exceptionInErrorPage = true; } if (exceptionInErrorPage) { Response.Redirect("Error.htm"); } else { Response.Redirect("Error.aspx"); } } }
public void UpdateOrderItem(Guid orderId, Guid subPlanId, string domainName, string invoiceNumber, string description, int status, string response) { XmlTraceWriter.Trace("--------1-------"); string cmdText = "update [OrderItem] set status=" + status.ToString() + ",response='" + response.Replace("'", "''") + "'" + ",InvoiceNumber='" + invoiceNumber + "'" + ",Description='" + description + "'" + " where OrderId='" + orderId.ToString() + "' and SubPlanId='" + subPlanId.ToString() + "'" + " and DomainName='" + domainName + "'"; XmlTraceWriter.Trace(cmdText); XmlTraceWriter.Trace("--------2-------"); connection.ExecuteSQL(cmdText); }
protected void Application_Error(object sender, EventArgs e) { Exception lastServerException = null; var url = HttpContext.Current.Request.Url.AbsoluteUri; SessionManager sessionM = new SessionManager(); string addtonalInfo = ""; try { addtonalInfo += Environment.NewLine + " SessionValues :" + sessionM.ToJasonString(); } catch { } try { var requestInputStream = new StreamReader(HttpContext.Current.Request.InputStream); var requestContent = requestInputStream.ReadToEnd(); requestInputStream.Close(); addtonalInfo += Environment.NewLine + " Request :" + requestContent; } catch { } try { Nullable <Guid> sessionId = null; lastServerException = Server.GetLastError(); if (sessionM["SessionFID"] != null) { sessionId = (Guid)sessionM["SessionFID"]; } var logger = ApiObjectFactory.GetObject <ResellerClub.Interface.IExceptionLogger>(); logger.LogException(lastServerException, sessionId, Helper.GetIPAddress(), url, addtonalInfo, lastServerException.GetHashCode(), 0); } catch (Exception ex) { if (lastServerException != null) { XmlTraceWriter.TraceInfo("========================================================="); XmlTraceWriter.Trace(lastServerException); XmlTraceWriter.Trace(ex); XmlTraceWriter.TraceInfo("========================================================="); } else { XmlTraceWriter.Trace(ex); } } finally { var exceptionInErrorPage = false; try { Server.Execute("/Error.aspx"); } catch (Exception ex) { exceptionInErrorPage = true; } if (exceptionInErrorPage) { Response.Redirect("/Error.htm"); } else { Response.Redirect("/Error.aspx"); } } }