How To Get The Source Code Of A Web Site Working With C# Programming Language

How To Get The Source Code Of A Web Site Working With C# Programming Language

Go ahead and open up up your text editor or what ever you use to jot down your code in. On the initial line we must insert a reference.

working with System.Web;Now allows go on and make a course and put the leading statement in it.

using System.Internet;

class System

static void Primary(string args)

To create items wonderful and thoroughly clean lets go on and make a string identified as “url” and set in whatsoever url we wish to have the source code of. Then lets go ahead and use that While using the HttpWebRequest process.

making use of Method.Web;

class Application

static void Principal(string args)

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

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

Alright ended up performing excellent, now allows receive the response…

working with Program.Net

course Software

static void Main(string args)

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

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

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

Given that we have the response we really need to simply call a StreamReader to read the response stream. We even have to add a reference to Method.IO to use the StreamReader.

using Method.Web;

using Procedure.IO;

class Application

static void Principal(string args)

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

HttpWebRequest request = (HttpWebRequest)WebRequest.Produce(url);

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

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

We’re almost finished. Now lets receive the supply code into string structure and shut the StreamReader…

utilizing Procedure.Net;

applying Program.IO;

course System

static void Major(string args)

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

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

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

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

string soureCode = sr.ReadToEnd();

sr.Shut();

All done, now you may Show the string made up of the sourceCode and manipulate it even so you want!

How To Get The Source Code Of A Web Site Working With C# Programming Language

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.