C# Asp.Net - See html output before sending it to the client

Post date: Feb 14, 2010 11:46:05 AM

protected override void Render(HtmlTextWriter writer) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); HtmlTextWriter tw = new HtmlTextWriter(new System.IO.StringWriter(sb)); //Render the page to the new HtmlTextWriter which actually writes to the stringbuilder base.Render(tw); //Get the rendered content string sContent = sb.ToString(); //Now output it to the page, if you want writer.Write(sContent); }