private void send_error_email()
{
try
{
// Start the body
StringBuilder builder = new StringBuilder();
builder.Append("\n\nSUBMISSION INFORMATION\n");
builder.Append("\tDate:\t\t\t\t" + DateTime.Now.ToString() + "\n");
builder.Append("\tIP Address:\t\t\t" + HttpContext.Current.Request.UserHostAddress + "\n");
builder.Append("\tHost Name:\t\t\t" + HttpContext.Current.Request.UserHostName + "\n");
builder.Append("\tBrowser:\t\t\t" + HttpContext.Current.Request.Browser.Browser + "\n");
builder.Append("\tBrowser Platform:\t\t" + HttpContext.Current.Request.Browser.Platform + "\n");
builder.Append("\tBrowser Version:\t\t" + HttpContext.Current.Request.Browser.Version + "\n");
builder.Append("\tBrowser Language:\t\t");
bool first = true;
string[] languages = HttpContext.Current.Request.UserLanguages;
if (languages != null)
{
foreach (string thisLanguage in languages)
{
if (first)
{
builder.Append(thisLanguage);
first = false;
}
else
{
builder.Append(", " + thisLanguage);
}
}
}
builder.AppendLine("HISTORY");
if (HttpContext.Current.Session["LastSearch"] != null)
builder.AppendLine("\tLast Search:\t\t" + HttpContext.Current.Session["LastSearch"]);
if (HttpContext.Current.Session["LastResults"] != null)
builder.AppendLine("\tLast Results:\t\t" + HttpContext.Current.Session["LastResults"]);
if (HttpContext.Current.Session["Last_Mode"] != null)
builder.AppendLine("\tLast Mode:\t\t\t?" + HttpContext.Current.Session["Last_Mode"]);
if (HttpContext.Current.Items.Contains("Original_URL"))
builder.AppendLine("\tURL:\t\t\t\t" + HttpContext.Current.Items["Original_URL"]);
else
builder.AppendLine("\tURL:\t\t\t\t" + HttpContext.Current.Request.Url);
// Send this email
try
{
Email_Helper.SendEmail(UI_ApplicationCache_Gateway.Settings.Email.System_Error_Email, "SobekCM Exception Caught [Invalid Item Requested]", builder.ToString(), false, String.Empty);
}
catch (Exception)
{
// Already catching errors.. nothing else to realy do here if this causes an error as well
}
}
catch (Exception)
{
// Already catching errors.. nothing else to realy do here if this causes an error as well
}
// Forward to our error message
HttpContext.Current.Response.Redirect(UI_ApplicationCache_Gateway.Settings.Servers.System_Error_URL, false);
HttpContext.Current.ApplicationInstance.CompleteRequest();
if (currentMode != null)
currentMode.Request_Completed = true;
}