Capturing Output from ASP.Net Pages

ref http://www.west-wind.com/weblog/posts/481.aspx

///

/// Overridden to handle Confirmation of the order by

/// capturing the HTTP output and emailing it.

///

///

protected override void Render(HtmlTextWriter writer)

{

// *** Write the HTML into this string builder

StringBuilder sb = new StringBuilder();

StringWriter sw = new StringWriter(sb);

HtmlTextWriter hWriter = new HtmlTextWriter(sw);

base.Render(hWriter);

// *** store to a string

string PageResult = sb.ToString();

// *** Write it back to the server

writer.Write(PageResult);

}