locked
C# windows code to C# windows phone RRS feed

  • Question

  • Hello,

    It has been 2 days trying to create the alternative of my C# windows to C# windows phone and I can't make 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 it's easy to understand. It gets the source of the server.

    So here is my question; how can I do something similar in C# windows phone(windows phone 8.1/8)?

    Please lend me a hand here before I go crazy.

    Maria

    Saturday, August 15, 2015 8:52 PM

Answers