protected void Page_Load(object sender, EventArgs e) { string response = ""; try { string body = GetValue("Body"); string from = GetValue("From"); string city = GetValue("FromCity"); string state = GetValue("FromState"); string zip = GetValue("FromZip"); string country = GetValue("FromCountry"); if (string.IsNullOrEmpty(body) == false && string.IsNullOrEmpty(from) == false) { //Refactor this! DomainLogic ugitFitDataTracker = new UGFClassFactory().CreateUGFDomainMgr(); response = ugitFitDataTracker.ProcessTextMessageReceived(country, state, city, from, body, this.IsTestWebPage); } } catch (Exception exp) { response = "Error: " + exp.Message + "<br/><br/>"; Exception expInner = exp.InnerException; while (expInner != null) { response += expInner.Message + "<br/><br/>"; expInner = expInner.InnerException; } } if (response.isNullOrEmpty()) { response = "Response is null? idk why!"; } if (!string.IsNullOrEmpty(response)) { int length = response.Length; Response.Clear(); Response.ContentType = "text/xml"; if (this.IsTestWebPage) { response += string.Format(" (text length: {0})", length); } string twilioResponse = string.Format("<Response><Sms>{0}</Sms></Response>", response); Response.Write(twilioResponse); } }
protected void Page_Load(object sender, EventArgs e) { string response = ""; try { string body = GetValue("Body"); string from = GetValue("From"); string city = GetValue("FromCity"); string state = GetValue("FromState"); string zip = GetValue("FromZip"); string country = GetValue("FromCountry"); if (string.IsNullOrEmpty(body) == false && string.IsNullOrEmpty(from) == false) { //Refactor this! DomainLogic ugitFitDataTracker = new UGFClassFactory().CreateUGFDomainMgr(); response = ugitFitDataTracker.ProcessTextMessageReceived(country, state, city, from, body, this.IsTestWebPage); } } catch (Exception exp) { try { string path = string.Format("Error: {0}", exp.Message); //string.IsNullOrEmpty } catch { }//I"ll response = "An unexpected error occurred"; } if (!string.IsNullOrEmpty(response)) { int length = response.Length; Response.Clear(); Response.ContentType = "text/xml"; if (this.IsTestWebPage) { response += string.Format(" (text length: {0})", length); } string twilioResponse = string.Format("<Response><Sms>{0}</Sms></Response>", response); Response.Write(twilioResponse); } }