0

I want to display a song list in a textBlock which is retrieved from a site but when I use httpwebStreamReader.ReadToEnd() I get other results than visiting this site from my computer explorer. Here is the code:

using (StreamReader httpwebStreamReader = new StreamReader(myResponse.GetResponseStream()))
{
            string results = httpwebStreamReader.ReadToEnd();
            Dispatcher.BeginInvoke(() => { textBlock1.Text = results;});
}
//this is the site-> http://5.9.17.81:9996/played.html

this is what i get: image

metz
  • 11
  • 2
  • What kind of `other results` ? – L.B Jun 18 '12 at 16:00
  • Have you tried to set the `UserAgent` to something like `Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)` ? – L.B Jun 18 '12 at 16:38
  • No it is HttpWebRequest's property. Or if your class has a `Headers` propery, you can also use `req.Headers.Add("User-Agent","...")` – L.B Jun 18 '12 at 17:24
  • I find out how to make it but now I want to show only some specific items! not the whole source-code. Any ideas how to do that? – metz Jun 18 '12 at 17:31
  • Although this starts to be another question, search for `HtmlAgilityPack` – L.B Jun 18 '12 at 17:36
  • thanks a lot! I will figure it out now :D – metz Jun 18 '12 at 17:40

0 Answers0