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?


Yes, you can use the WebClient class:

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

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

Need Your Help

jQuery UI 1.8.13 resizable() icon not showing

jquery jquery-ui resizable

In both jQuery 1.8.12 and 1.8.13 i no longer get the se handle icon which gets placed at the bottom right of the element to indicate this element is resizable.

Execute Code only after Multiple Promises Fulfilled in EmberJS

javascript ember.js

I have an EmberJS ArrayController. I want to have a computed property on this controller, neurons, that is a subset of the model property. The subset is computed based on a toggle button in the si...