0

i have a windows phone project and i am trying to post data to website and get the data
i have working windows form project code but when i try to use that code on wp8 i get error says

Error 2 'System.Net.HttpWebRequest' does not contain a definition for 'GetResponse' and no extension method 'GetResponse' accepting a first argument of type 'System.Net.HttpWebRequest' could be found (are you missing a using directive or an assembly reference?) C:\Users\cihad\documents\visual studio 2012\Projects\molitva\molitva\vaktija.xaml.cs 91 61 molitva

here is my code

public string GetHtml(int id)
        {
            var request = (HttpWebRequest)WebRequest.Create("http://www.vaktija.ba/mobile/");
            request.Method = "POST";
            byte[] byteArray = System.Text.Encoding.UTF8.GetBytes("gradovi=" + id);
            request.ContentLength = byteArray.Length;
            var dataStream = request.GetRequestStream();
            dataStream.Write(byteArray, 0, byteArray.Length);
            dataStream.Close();
            WebResponse response = (HttpWebResponse)request.GetResponse();
            dataStream = response.GetResponseStream();
            var reader = new System.IO.StreamReader(dataStream);
            var html = reader.ReadToEnd();
            reader.Close();
            dataStream.Close();
            response.Close();
            return html;
        }

so what can i do

Edited by Jihadyildiz

2
Contributors
1
Reply
8
Views
3 Years
Discussion Span
Last Post by hericles
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.