How To Find The Resource Code Of A Web Site Utilizing C# Programming Language

How To Find The Resource Code Of A Web Site Utilizing C# Programming Language

Go ahead and open up your text editor or what ever you employ to write your code in. On the main line we have to include a reference.

working with Method.Internet;Now allows go ahead and make a course and put the main statement in it.

applying System.Web;

class Program

static void Main(string args)

To make issues good and thoroughly clean lets go ahead and make a string identified as “url” and place in whichever url we wish to obtain the supply code of. Then allows go ahead and use that Using the HttpWebRequest approach.

applying Program.Net;

course Application

static void Most important(string args)

string url = “http://www.quack ware.com”;

HttpWebRequest ask for = (HttpWebRequest)WebRequest.Produce(url);

Alright were carrying out good, now allows obtain the response…

making use of Program.Web

course Application

static void Most important(string args)

string url = “http://www.quack ware.com”;

HttpWebRequest ask for = (HttpWebRequest)WebRequest.Make(url);

HttpWebResponse reaction = (HttpWebResponse)request.GetResponse();

Now that we provide the reaction we need to contact a StreamReader to read through the reaction stream. We even have so as to add a reference to Technique.IO to use the StreamReader.

using Procedure.Internet;

using Method.IO;

course Method

static void Primary(string args)

string url = “http://www.quack ware.com”;

HttpWebRequest ask for = (HttpWebRequest)WebRequest.Generate(url);

HttpWebResponse response = (HttpWebResponse)ask for.GetResponse();

StreamReader sr = new StreamReader(response.GetResponseStream());

We’re Nearly done. Now lets obtain the supply code into string structure and shut the StreamReader…

using Program.Internet;

employing Program.IO;

class Plan

static void Principal(string args)

string url = “http://www.quack ware.com”;

HttpWebRequest ask for = (HttpWebRequest)WebRequest.Create(url);

HttpWebResponse reaction = (HttpWebResponse)ask for.GetResponse();

StreamReader sr = new StreamReader(response.GetResponseStream());

string soureCode = sr.ReadToEnd();

sr.Shut();

All completed, now you can Exhibit the string that contains the sourceCode and manipulate it having said that you wish!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.