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

Carousel/slider of a grid of multiple elements

jquery

I am trying to make a jquery carousel similar to the one in 'People who liked this also liked' section at the bottom of this IMDB page

Devexpress GridView Selected Row

c# winforms gridview devexpress filtering

I have a gridList in my c# project. There is more than 100 000 records in my gridList. I want to do some operation on filtered rows. For example I filtered gridList by 'name' column ,then I want to

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.