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

G

Guest

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

e.g.

<htm>....
</html>

all content
 
J

John Timney \(MVP\)

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top