Go on and open up your text editor or whatsoever you employ to write your code in. On the first line we must include a reference.
applying Procedure.Internet;Now lets go ahead and create a course and set the principle statement in it.
utilizing Process.Web;
class Program
static void Primary(string args)
To create points awesome and clean up lets go ahead and make a string identified as “url” and set in whichever url we want to have the resource code of. Then lets go on and use that with the HttpWebRequest system.
utilizing Method.Net;
class Plan
static void Most important(string args)
string url = “http://www.quack ware.com”;
HttpWebRequest request = (HttpWebRequest)WebRequest.Make(url);
Alright had been performing excellent, now allows obtain the response…
employing Method.Net
course Software
static void Key(string args)
string url = “http://www.quack ware.com”;
HttpWebRequest request = (HttpWebRequest)WebRequest.Build(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Given that we contain the reaction we really need to get in touch with a StreamReader to read the response stream. We even have to incorporate a reference to Process.IO to make use of the StreamReader.
making use of Technique.Web;
making use of Process.IO;
course Method
static void Principal(string args)
string url = “http://www.quack ware.com”;
HttpWebRequest ask for = (HttpWebRequest)WebRequest.Produce(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader sr = new StreamReader(reaction.GetResponseStream());
We are almost completed. Now lets obtain the source code into string structure and close the StreamReader…
utilizing System.Net;
using Technique.IO;
class Plan
static void Main(string args)
string url = “http://www.quack ware.com”;
HttpWebRequest request = (HttpWebRequest)WebRequest.Generate(url);
HttpWebResponse response = (HttpWebResponse)ask for.GetResponse();
StreamReader sr = new StreamReader(reaction.GetResponseStream());
string soureCode = sr.ReadToEnd();
sr.Shut();
All completed, now you can display the string made up of the sourceCode and manipulate it on the other hand you wish!