Is there a web part that is used to pull in full HTML from external source

Kurt Muller asked on March 16, 2018 09:44

Hi all

I am looking for a webpart that will be able to pull full HTML from another Kentico site under the same Kentico installation.

i.e: Kentico site #1 has blank page content which needs to populate a webpart on site #2.

Is this at all possible, WITHOUT the use of an iFrame.

Thanks

Recent Answers


Trevor Fayas answered on March 16, 2018 13:35

Webpart, no, but one could be created. It's easy to do if it was on the same Kentico installation but since it's on another you will need to create a custom web part that will make a web request off the page, probably need to use the code below to get the content then use the HTML agility pack in c# to select the right spot and populate an aspx literal with the content.

using (WebClient client = new WebClient())
{
    string htmlCode = client.DownloadString("http://somesite.com/default.html");
}

And an example of agility pack

0 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on March 16, 2018 14:11 (last edited on March 16, 2018 14:11)

You can do it with jquery load on the client side. i.e. put in your div html from div on somehting on another web site. If you want to do it on the server side I would recommend HTMLAgilityPack so you can easily extract the piece of HTML from another page.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.