0
在我的Windows手机应用程序中,我想采用简单的字符串url,并且当该url在浏览器中输入时,它只在网页上显示JSon字符串,作为响应。 所以我想在我的应用程序中输入该网址,然后获取该JSON字符串作为回报,我该怎么做?我试过以下,但getResponse函数不存在于Silverlight中。windows silverlight手机应用程序从url获取json响应
string strUrl = "http://.....";
WebRequest request = HttpWebRequest.Create(strUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream s = (Stream)response.GetResponseStream();
StreamReader readStream = new StreamReader(s);
string dataString = readStream.ReadToEnd();
response.Close();
s.Close();
readStream.Close();
*我想要一个简单的字符串url * - 你能改说吗?你的意思是*我想下载一个简单的字符串url *?如果是这样,你可以使用'DownloadStringAsync'如下所示:https://blogs.msdn.microsoft.com/silverlight_sdk/2008/04/01/using-webclient-and-httpwebrequest/或https://social.msdn。 microsoft.com/Forums/silverlight/en-US/55dd1038-e3be-4471-8e5f-bec10e9d8d54/webclient-downloadstring-not-recognized-in-silverlight-code-behind?forum=silverlightarchieve? – dbc
我已经修改了我的问题,现在请再次阅读:) – touseef