How do you pull html from url?

I have one site that displays html content to be displayed on another site (the first site is the interface for content management).

So site1 page = http: // site1 / pagecontent

and on site 2 ( http: // site2 / pagecontent ) I need to show the content specified on page 1 of the site.

I am using .Net C # (MVC) and don't want to just use an iframe.

Is there a way to suck html into a string variable?

0


source to share


2 answers


Yes, you can use the WebClient class: http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx



WebClient wClient = new WebClient();
string s = wClient.DownloadString(site2);

      

+1


source


+1


source







All Articles