locked
what wrong with my code ?? RRS feed

  • Question

  • i am trying to receive a website (the all source of html and js and etc) this is my code

    HttpWebRequest request = (HttpWebRequest)WebRequest.CreateHttp("http://www.google.com");
    var response = await request.GetResponseAsync();
    return response.GetResponseStream();


    and the app stucks in GetResponseAsync

    Friday, July 26, 2013 9:00 AM

Answers

  • You won't receive all of the content in this manner.  You will receive only the HTML.  The JS, CSS, and images will all require their own request.  What are you trying to do here?  Is google.com the site you are actually trying to request, or is that a dummy address?  Also, there's an HTTPClient sample here: http://code.msdn.microsoft.com/windowsapps/HttpClient-sample-0c4d3c6c

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, July 26, 2013 7:25 PM
    Moderator

All replies

  • You won't receive all of the content in this manner.  You will receive only the HTML.  The JS, CSS, and images will all require their own request.  What are you trying to do here?  Is google.com the site you are actually trying to request, or is that a dummy address?  Also, there's an HTTPClient sample here: http://code.msdn.microsoft.com/windowsapps/HttpClient-sample-0c4d3c6c

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Friday, July 26, 2013 7:25 PM
    Moderator
  • it's just a dummy address. anyway the problem i don't receive anything it's just stuck and nothing happen (i wait 2 min to response i think it's quite enough).

    it's app i am write for manipulate things in webpage

    and i check the sample you gave 

    thks for help

    • Edited by eli chen Saturday, July 27, 2013 6:05 PM none
    Saturday, July 27, 2013 5:51 PM