Reputation: 3064
The following error started coming up suddenly! It worked for months after the application was deployed on the server but suddenly it has stopped working and showing the following error.
The code I am using as follows:
private void PostData()
{
c.Add("publicid", "xxxxxxxxxxxxxxxxxxxxxx");
c.Add("name", "ABC");
c.Add("label:Affiliate_ID", "207");
c.Add("website", "websitename.com");
c.Add("label:IP_Address", Request.ServerVariables["REMOTE_ADDR"]);
c.Add("firstname", txtFirstName.Text.Trim());
c.Add("phone", txtPhone.Text.Trim());
c.Add("lastname", txtLastName.Text.Trim());
c.Add("email", txtEmail.Text.Trim());
c.Add("label:Date_of_Birth", String.Format("{0:YYYY-MM-DD}", Convert.ToDateTime(txtDob.Text.Trim())));
c.Add("lane", txtStreetAddress.Text.Trim());
c.Add("code", txtZip.Text.Trim());
c.Add("city", txtCity.Text.Trim());
c.Add("Province", txtProvince.Text.Trim());
c.Add("label:Time_At_Address", stay.ToString(CultureInfo.InvariantCulture));
c.Add("label:Known_Credit_Issues", "yes");
c.Add("label:Net_Monthly_Income", txtMothlyIncome.Text.Trim());
c.Add("label:Occupation", txtOccopation.Text.Trim());
c.Add("label:Employer_Name", txtEmployer.Text.Trim());
c.Add("label:Employment_Length", "");
c.Add("label:Bankruptcy", "No");
c.Add("label:Employer_Phone_Number", "");
c.Add("label:Employer_Postal_Code", "");
c.Add("label:Employer_Province", "");
c.Add("label:Employer_City", "");
c.Add("label:Employer_Address", "");
var myWebClient = new System.Net.WebClient();
const string postingUrl = "https://xxxx.com/modules/Webforms/capture.php";
byte[] responseArray = null;
responseArray = myWebClient.UploadValues(postingUrl, "POST", c);
var responseData = Encoding.ASCII.GetString(responseArray);
}
Please help! It is a live application :(
Thanks in advance.
Upvotes: 0
Views: 1182
Reputation: 24400
I'm going to take a shot in the dark and say that a system-wide proxy has been set on your server and since WebClient
instances use that by default, it's now failing.
After:
var myWebClient = new System.Net.WebClient();
Add:
myWebClient.Proxy = null;
Recompile/restart the app and let me know if my voodoo debugging sense was right or utter BS.
Upvotes: 0