There are no comments yet...Kick things off by posting your opinion.
ASP.NET include remote HTML
So, you have a webpage. And than you have to include some HTML from remote server? And there is no web service, AJAX Json or any other advanced stuff, just plain include, right? Well, it’s pretty easy to do that with ASP.NET.
Just today I needed that functionality and I did some easy setup here.
I have used Web User Control, so the code is a little bit more viewable than including function in page.
I have uploaded code on my SkyDrive, so you can easily download it (for code look below for a link). Here are just some very simple instructions on how to use it:
- Put files
RemotePageInclude.ascxandRemotePageInclude.ascx.csin the same folder (or some other folder, but than you would need to change path in header tag in next step) as your aspx file - Put a header into aspx file, where you would like to have this include:
<%@ Register src="RemotePageInclude.ascx" tagname="RemotePageInclude" tagprefix="uc1" %> - That’s almost it, you just have to insert element tag, where you need include:
<uc1:RemotePageInclude ID="WebUserControl1" URL=”http://www.example.com/file.html” runat="server" />
ID is name of control, you can change that in whatever you like (used for accessing form code behind)
URL is the attribute, where you put address of page, you would like to include - And you’re done!
That’s it! Oh, and here is direct download from my SkyDrive.
author: Aleš Rosina | Comments: 0 | Tags: asp-net, projects
08
May
2009
May
2009
