【发布时间】:2015-02-04 10:36:11
【问题描述】:
我正在尝试使用 Web 客户端类将 JSON 字符串发送到服务器,但未返回任何结果,我已尝试使用 Rest Client 插件以确保服务器正在返回某些内容,这是我的 postRequest 方法`
public static void PostRequest(WebClient webclient,string data,string
url,string header,string method)
{
Uri uri = new Uri(url, UriKind.Absolute);
webclient.Headers[HttpRequestHeader.ContentType] = header;
webclient.UploadStringAsync(uri,method,data);
}
这里是我调用这个方法的地方
string newUserJson="{"User_Name":"yosyos","First_Name":"gfhgas","Last_Name":"jagfshg"}";
wc = new WebClient();
wc.UploadStringCompleted += new UploadStringCompletedEventHandler(wb_UploadStringCompleted);
string url = "http://670b9ada.ngrok.com/laravelProjects/TestVisWall/public/users";
helper.PostRequest( wc, newUserJson, url, "application/json", "POST");
【问题讨论】:
标签: json windows-phone-8 windows-phone webclient