title: WP7 how to load complete web page with httpwebrequest/httpwebresponse (in the moment just displaying parts of it))
body: <p>I've got a problem with loading a web page. Somehow it seems like the response I get is not complete because only the first part of the page is shown. When writing out the response stream using ReadToEnd it only displays about 700 characters in the string, no matter which web page I'm trying to browse. See code down below:</p>
  
  <pre><code>public class GetServerResponse
  {
      private Uri url;
  
      public GetServerResponse(Uri uri)
      {
          this.url = uri;
          HttpWebRequest h = (HttpWebRequest)WebRequest.Create(this.url);
          StartRequest(this.url);
      }
  
      private void StartRequest(Uri url)
      {
          HttpWebRequest internalRequest = (HttpWebRequest)WebRequest.Create(url);
          GetServerResponseState responseState = new GetServerResponseState();
          responseState.AsyncRequest = internalRequest;
  
          internalRequest.BeginGetResponse(new AsyncCallback(HandleServerResponse), responseState);
  
      }
  
      private void HandleServerResponse(IAsyncResult asyncResult)
      {
          GetServerResponseState responseState = (GetServerResponseState)asyncResult.AsyncState;
          HttpWebRequest internalRequest = (HttpWebRequest)responseState.AsyncRequest;
          internalRequest.AllowAutoRedirect = false;
  
          responseState.AsyncResponse = (HttpWebResponse)internalRequest.EndGetResponse(asyncResult);
  
          Stream streamResult;
          try
          {
              streamResult = responseState.AsyncResponse.GetResponseStream();
              using (StreamReader reader = new StreamReader(streamResult, Encoding.UTF8))
              {
                  System.Diagnostics.Debug.WriteLine(reader.ReadToEnd());
              }
          }
          catch (FormatException)
          {
              return;
          }
      }
  
  
  }
  public class GetServerResponseState
  {
      public HttpWebRequest AsyncRequest { get; set; }
      public HttpWebResponse AsyncResponse { get; set; }
  }
  </code></pre>