Search This Blog

Thursday, March 13, 2014

How to Request a Web Page and Retrieve the Results as a Stream

How to Request a Web Page and Retrieve the Results as a Stream
We can request a web page and retieve it as a stream using System.Net.WebClient class OpenRead()
method this method returns a stream object we can use this stream in our code for further processing
as given below:
using System.IO;
using System.Net;
WebClient myClient = new WebClient();
Stream objresponse = myClient.OpenRead("http://www.website.com/index.htm");
// The stream data is used here.
response.Close();

No comments:

Post a Comment