#region HttpPost protected string HttpPost(string url_, string contents_, bool useCredentials_, NetworkCredential creds_) { bool isSuccess = false; int noOfRetry = 0; string response = string.Empty; try { WriteToLog(string.Format("Starting HTTPPost Publishing message {0} \r\n {1}", url_, contents_)); while (!isSuccess && noOfRetry < m_noOfRetry) { WriteToLog("HTTPPost " + "Success Status :" + isSuccess.ToString() + " Retry Count: " + noOfRetry.ToString()); Uri url = new Uri(url_); HttpWebRequest _webRequest = (HttpWebRequest)WebRequest.Create(url); _webRequest.Timeout = 400000000; _webRequest.Method = "POST"; _webRequest.ContentType = "text/xml; charset=ISO-8859-1"; _webRequest.KeepAlive = true; _webRequest.Credentials = CredentialCache.DefaultNetworkCredentials; if (useCredentials_) { string password = string.Empty; string username = string.Empty; //if no credentails provided then use if (creds_ == null) { password = ConfigurationManager.AppSettings["password"] == null ? null : ConfigurationManager.AppSettings["password"].ToString(); username = ConfigurationManager.AppSettings["user"] == null ? null : ConfigurationManager.AppSettings["user"].ToString(); if (password == null || username == null) { WriteToLog(SMSConstants.INCOMPLETE_SMSGATEWAY_INFORMATION); throw new Exception(SMSConstants.INCOMPLETE_SMSGATEWAY_INFORMATION); } WriteToLog("Connecting using UserName :" + username); password = GetDecString(password); String userInfo = username + ":" + password; byte[] bt = new byte[userInfo.Length]; bt = System.Text.Encoding.UTF8.GetBytes(userInfo); string encodedData = Convert.ToBase64String(bt); String authInfo = "Basic " + encodedData; _webRequest.Headers.Set("Authorization", authInfo);