api keyname错误导致错误。所有传递的参数都是正确的。但是,我认为我传递参数的方式是错误的。请提出解决方案
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","arun.yva9@gmail.com");
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);
答案 0 :(得分:1)
而不是附加,使用'&'用于添加参数
string postData = string.Empty;
postData += "&apikey=ETG123";
postData +="&deviceid=12";
希望这会对你有所帮助。