HTTP Request

  • Thread starter Thread starter Lou
  • Start date Start date
L

Lou

When I request an http page, I only get partial pages when the pages are
large?

here is my code

// Create a 'WebRequest' object with the specified url

WebRequest myWebRequest = WebRequest.Create(this.URL);


// Send the 'WebRequest' and wait for response.

WebResponse myWebResponse = myWebRequest.GetResponse();

// Obtain a 'Stream' object associated with the response object.

Stream ReceiveStream = myWebResponse.GetResponseStream();

Encoding encode = System.Text.Encoding.GetEncoding("utf-8");

// Pipe the stream to a higher level stream reader with the required
encoding format.

StreamReader readStream = new StreamReader( ReceiveStream, encode );

string htmlData="";

htmlData=readStream.ReadToEnd();
 
Can you define "partial pages"? What part are you getting? Is it cutting out
after a specific number of bytes every time? Is it throwing any exceptions?

Have you read the documentation for ReadToEnd() regarding the default 4K
buffer size? By chance are you getting an out of memory exception at 4K?

Pete
 
Like Pete asks, what is a partial page? And what is large? Is it cutting
off at a specifc number of bytes? Also, do you have this wrapped in a
try/catch?
 
Back
Top