Labels

slider

Recent

Navigation

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

Introduction

If you want to get the exact idea about How to Request a Web Page and Retrieve the Results as a Stream, you must have enough knowledge about all functions of stream. Using stream is a genuine approach to send and receive Web data. Your application can use Stream.Write to send data and can use and Stream.Read to receive data from the web files written in XML, HTML, or anything else, and for this requirement, you must have a sound web connection.  Generally, Streams are utilized throughout the .NET Framework, which has sufficient infrastructure co control them throughout different network connection.

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

For the following steps, you need to insert References to the ‘System.IO and System.Net namespaces

Step #1

First you need to set a variable for the new WebClient on which you’re going to develop this application.

Step #2

Stream response is used to read data from the webClient URL https://technologycrowds.com/ through myClient.OpenRead().


Step #3

Now you have close the response stream by the response.Close() method.

Step #4

Now it’s time to compile the code and retrieve the result.

Please note that you can follow web request method before proceeding to the above steps.
Hope, you must have a better idea about How to Request a Web Page and Retrieve the Results as a Stream.

var myClient = new WebClient();
Stream response = myClient.OpenRead("https://technologycrowds.com/");
// The stream data is used here.
response.Close();
Share

Anjan kant

Outstanding journey in Microsoft Technologies (ASP.Net, C#, SQL Programming, WPF, Silverlight, WCF etc.), client side technologies AngularJS, KnockoutJS, Javascript, Ajax Calls, Json and Hybrid apps etc. I love to devote free time in writing, blogging, social networking and adventurous life

Post A Comment:

0 comments: