0

Was using a Literal Control to output a ton of HTML, but this caused the site to load rather slowly. The HTML is user inputted and is different, so not sure what Control, if any to use. I am able to get the string of the HTML within Umbraco to be outputted, but the problem I am having is how to output the HTML in a way that doesn't destroy the site on system resources. Cause right now, with a Literal Control outputting the HTML, it takes like 20 minutes for a page to load and than it ruins the entire site for 5 minutes after that due to taking up 100% System Resources.

How can I output HTML within a page? Have seen something like this code here:

public string RenderControlToHtml(Control ControlToRender)
{
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    System.IO.StringWriter stWriter = new System.IO.StringWriter(sb);
    System.Web.UI.HtmlTextWriter htmlWriter = new System.Web.UI.HtmlTextWriter(stWriter);
    ControlToRender.RenderControl(htmlWriter);
    return sb.ToString();
}

But, first, this looks like it it meant to render a control. I don't have a control, I have the HTML already. Honestly don't know how to even use a control, other than the Literal Control to output HTML. Basically, the HTML is within a method and is a string like this:

thePillarsPage.Html

How can I use this to output this content within a section of a page? The method above looks nice, but not sure where the thePillarsPage.Html string should fit into that method, or if that is even possible with that method?

Thanks :)

Solomon Closson
  • 6,111
  • 14
  • 73
  • 115
  • If it takes 20 minutes to render HTML - just how big is it? – Yuriy Galanter Mar 24 '14 at 18:15
  • Over 1000 lines long, I don't think a Literal Control is built for this type of thing. Need to find a way to render HTML as if it is a part of the page, and have it load normally, instead of taking forever to load and eating up resources. – Solomon Closson Mar 24 '14 at 18:16

0 Answers0