C#窗口C#电话窗户 [英] C# windows to C# phone windows
本文介绍了C#窗口C#电话窗户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是一个多任务的要求不是帮助,但... 1天后的尝试,我不能得到它的工作。
这是我的代码
This is more a task to ask than help but... after 1 day of tries I can't get it work. This is my code
private string _InetReadEx(string sUrl)
{
HttpWebRequest webReq = (HttpWebRequest)HttpWebRequest.Create(sUrl);
try
{
webReq.CookieContainer = new CookieContainer();
webReq.Method = "GET";
using (WebResponse response = webReq.GetResponse())
{
using (Stream stream = response.GetResponseStream())
{
StreamReader reader = new StreamReader(stream);
aRet = reader.ReadToEnd();
return aRet;
}
}
}
catch (Exception ex)
{
return ex.Message;
}
}
这段代码的含义很简单。它返回一个服务器的源。
因此,这里是我的愚蠢的问题;我该怎么做C#的Windows Phone(Windows Phone的8.1 / 8)?
What this code does is simple. It returns the source of a server. So here is my silly question; how can I do something similar on C# windows phone(windows phone 8.1/8)?
感谢你在前进,
玛丽亚
Thank you in advance, Maria
推荐答案
我建议你使用的 HttpClient的我已经在Windows /赢手机项目中使用它都和作品就像一个魅力,看一看的此内容太
I'd suggest you to use the HttpClient I have used it both in Windows / Win Phone projects and works like a charm, have a look at this too
这篇关于C#窗口C#电话窗户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文