how do you pull in the html from a URL?

I have one site that is displaying html content that needs to be displayed on another site (first site is front end to content management system).

So site1 page = http://site1/pagecontent

and on site 2 (http://site2/pagecontent) I need to be able to display the contents shown on site 1 page.

I am using .Net C# (MVC), and do not want to just use an iframe.

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

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);

Sure. See the System.Net.WebClient class, specificially, the DownloadString() method.


Need Your Help

Building live555 Streaming Media in Windows result in .obj files, not .a

build make live555

I'm trying to stream rtsp video via tcp using mplayer in windows minGW shell and it depends on live555 streaming media library.

What are best practices/methods in preventing ajax requests and or form submisions from pages that my server did not serve?

javascript ajax security

Knowing that anyone can see my AJAX URL string and or forms how can I prevent calls or submissions from pages that my server did not serve?

Networkx graph: finding if path exists between any node in a given set of nodes and another set of nodes

python graph nodes networkx edges

I have a large undirected graph with hundreds of thousands of nodes and tens of thousands of edges. I have two separate problems: