public static string LogError(HttpRequest request, string errorurl, Exception error) { if (ConfigurationManager.AppSettings["install_mode"] == "false") { string errorlog = "Error caught in Application_Error event on " + "page <a href='" + errorurl + "'>" + errorurl + "</a>\r\n\r\n"; errorlog += error.ToString(); if (error.Message != null) errorlog += "Message: " + error.Message.ToString() + "\r\n\r\n"; if (error.StackTrace != null) errorlog += "Stack Trace: " + error.StackTrace.ToString(); errorlog += "Raw URL: " + request.RawUrl + "?" + request.QueryString.ToString() + "\r\n"; errorlog += "Form: " + request.Form.ToString() + "\r\n"; if (request != null) { errorlog += "UserHostAddress: " + request.UserHostAddress + "\r\n"; errorlog += "Referral URL: " + request["ReferralUrl"] + "\r\n"; errorlog += "User Agent: " + request.UserAgent + "\r\n\r\n"; } for (int i = 0; i < request.Form.Keys.Count; i++) { errorlog += request.Form.Keys[i] + ": " + request.Form[request.Form.Keys[i]] + "\r\n"; } for (int i = 0; i < request.Files.Count; i++) { errorlog += "\r\nFile '" + request.Files[i].FileName + "' of type " + request.Files[i].ContentType + " was in the posted data.\r\n\r\n"; } MailMessage msg = new MailMessage("*****@*****.**", ConfigurationManager.AppSettings["admin_address"]); msg.Subject = "Weavver System - Website Error"; msg.Body = errorlog; SmtpClient sClient = new SmtpClient(ConfigurationManager.AppSettings["smtp_server"], Int32.Parse(ConfigurationManager.AppSettings["smtp_port"])); sClient.Send(msg); send_message_chat message = new send_message_chat(); message.from = "weavver.com"; message.to = GlobalSettings.AdminAddress; message.body = msg.Body; ejabberdRPC rpc = new ejabberdRPC(); //rpc.SendMessageChat(message); return errorlog; } return "Install mode is on. Please check that."; }
protected void Send_Click(object sender, EventArgs e) { send_message_chat message = new send_message_chat(); message.from = "weavver.com"; message.to = ConfigurationManager.AppSettings["admin_address"]; message.body = "User at " + Request.UserHostAddress + " says asdf asdf asfd"; Weavver.Vendors.ProcessOne.ejabberdRPC rpc = new Weavver.Vendors.ProcessOne.ejabberdRPC(); rpc.SendMessageChat(message); status s = new status(); CookComputing.XmlRpc.XmlRpcStruct statResponse = rpc.Status(s); PrintStruct(statResponse); }