How to get the current aspx page innerhtml in code-behind

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How to get the current aspx page innerhtml in code-behind

e.g.

<htm>....
</html>

all content
 
You can get the page output by grabbing the render event to put the rendered
output into a string.

protected override void Render(HtmlTextWriter output)
{
StringWriter sw;
HtmlTextWriter htmltw;
sw = new StringWriter();
htmltw = new HtmlTextWriter(sw);
base.Render(htmltw);
StringBuilder temp = sw.GetStringBuilder();
// here do whatever you like with temp
base.Render(output);
}

Its a commonly asked question, so lots of example on google.
--
--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
 
Back
Top