HTTP Request

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();
 
P

Pete Davis

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
 
W

William Ryan

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top