C# windows to C# phone windows

允我心安 提交于 2020-01-03 06:38:27

问题


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;
            }

        }

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

来源:https://stackoverflow.com/questions/32029261/c-sharp-windows-to-c-sharp-phone-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!