Public Class CaughtError
Public Sub showMeTheError(ByVal xXx As Exception)
If xXx.Message.ToString = "Thread was being aborted." Then
Exit Sub
End If
If CBool(ConfigurationSettings.AppSettings("sendEmails")) = True Then
Dim str As New StringBuilder
str.Append("<strong>Please contact IT Development regarding this error.<strong><br><br><TABLE id='tbl' style='HEIGHT: 358px' borderColor='#990000' cellSpacing='1' cellPadding='1' width='600' border='1'>")
str.Append("<TR><TD style='COLOR: white' bgColor='#990000'>Error Tracking Message: Task List</TD>")
str.Append("</TR><TR><TD><TABLE id='Table1' style='WIDTH: 592px; HEIGHT: 307px' cellSpacing='1' cellPadding='1'")
str.Append("width='592' border='0'><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>User:</STRONG></TD><TD vAlign='top'>")
str.Append(Current.Request.Cookies("TPLATE")("NAME").ToString)
str.Append("</TD></TR><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>Email:</STRONG></TD>")
str.Append("<TD vAlign='top'><A href='mailto:")
str.Append(Current.Request.Cookies("TPLATE")("UID"))
str.Append("@virchowkrause.com'>Email User</A></TD></TR><TR>")
str.Append("<TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>Error Message:</STRONG></TD><TD vAlign='top'>")
str.Append(xXx.Message.ToString)
str.Append("</TD></TR><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>Source:</STRONG></TD><TD vAlign='top'>")
str.Append(xXx.Source.ToString)
str.Append("</TD></TR><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>Stack Trace:</STRONG></TD><TD vAlign='top'>")
str.Append(xXx.StackTrace.ToString)
str.Append("</TD></TR><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>URL:</STRONG></TD><TD vAlign='top'>")
str.Append(Current.Request.RawUrl.ToString)
str.Append("</TD></TR><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>Date/Time:</STRONG></TD>")
str.Append("<TD vAlign='top'>" & Date.Now.ToString & "</TD></TR></TABLE></TD></TR></TABLE>")
Dim status As String
Dim email As New workflowMailer
email.toAddresses = ConfigurationSettings.AppSettings("HelpDeskEmail")
email.subject = "VK Forms Error Notification from " & Current.Request.Cookies("TPLATE")("NAME")
email.body = str.ToString
email.sendMail()
email.Dispose()
email = Nothing
Current.Response.Redirect("../../teamplateforms.net/workflowhome/vkerror.aspx")
Else
Dim str As New StringBuilder
str.Append("<strong>Please contact IT Development regarding this error.<strong><br><br><TABLE id='tbl' style='HEIGHT: 358px' borderColor='#990000' cellSpacing='1' cellPadding='1' width='600' border='1'>")
str.Append("<TR><TD style='COLOR: white' bgColor='#990000'>Error Tracking Message: Task List</TD>")
str.Append("</TR><TR><TD><TABLE id='Table1' style='WIDTH: 592px; HEIGHT: 307px' cellSpacing='1' cellPadding='1'")
str.Append("width='592' border='0'><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>User:</STRONG></TD><TD vAlign='top'>")
str.Append(Current.Request.Cookies("TPLATE")("NAME").ToString)
str.Append("</TD></TR><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>Email:</STRONG></TD>")
str.Append("<TD vAlign='top'><A href='mailto:")
str.Append(Current.Request.Cookies("TPLATE")("UID"))
str.Append("@virchowkrause.com'>Email User</A></TD></TR><TR>")
str.Append("<TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>Error Message:</STRONG></TD><TD vAlign='top'>")
str.Append(xXx.Message.ToString)
str.Append("</TD></TR><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>Source:</STRONG></TD><TD vAlign='top'>")
str.Append(xXx.Source.ToString)
str.Append("</TD></TR><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>Stack Trace:</STRONG></TD><TD vAlign='top'>")
str.Append(xXx.StackTrace.ToString)
str.Append("</TD></TR><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>URL:</STRONG></TD><TD vAlign='top'>")
str.Append(Current.Request.RawUrl.ToString)
str.Append("</TD></TR><TR><TD style='WIDTH: 120px' vAlign='top' align='left'><STRONG>Date/Time:</STRONG></TD>")
str.Append("<TD vAlign='top'>" & Date.Now.ToString & "</TD></TR></TABLE></TD></TR></TABLE>")
Current.Response.Write(str.ToString)
Current.Response.End()
End If
End Sub
End Class