Reputation: 163
It get an error api keyname is incorrect. All the parameters which were passed are correct. However, I think the way I am passing the parameters is wrong. Please suggest a solution
StringBuilder postData = new StringBuilder();
postData.AppendFormat("{0}={1}", "apikey" ,"ETG123");
postData.AppendFormat("{0}={1}", "deviceid" ,"12");
postData.AppendFormat("{0}={1}", "name" ,"arun");
postData.AppendFormat("{0}={1}", "email","[email protected]");
postData.AppendFormat("{0}={1}", "dob", "10-10-1990");
postData.AppendFormat("{0}={1}", "mobileno", "9848022338");
postData.AppendFormat("{0}={1}", "country", "India");
postData.AppendFormat("{0}={1}", "companyname", "etg");
postData.AppendFormat("{0}={1}", "city", "hyderabad");
WebClient wc = new WebClient();
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
wc.UploadStringAsync(new Uri("http://192.168.0.149/redington/Services/register_user", UriKind.Absolute), "POST",postData.Tostring());
wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wc1_UploadStringCompleted);
Upvotes: 0
Views: 282
Reputation: 515
Rather than appending, use '&' for adding parameters
string postData = string.Empty;
postData += "&apikey=ETG123";
postData +="&deviceid=12";
Hope this will help you.
Upvotes: 1