Current Pages Response Stream

  • Thread starter Thread starter Stephen robinson
  • Start date Start date
S

Stephen robinson

Dear All,

I wonder if someone can help me I would like to capture the response
stream/HTML of the current page I am calling so that as well as
producing the HTML for the client I can also create say a PDF file on
the fly. I can not use HTTPRequest as I basically wish to print the
current page in PDF and this will include a potentially large view state
as well as the request parameters. Also it would mean loading the page
twice which I dont really want to do.

Any help would be greatfully received.

Steve
 
I'm not sure if this will help, but it you want to capture the html string
that is sent to the browser this will work.
Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)

Dim _stringBuilder As StringBuilder = New StringBuilder()
Dim _stringWriter As StringWriter = New StringWriter(_stringBuilder)
Dim _htmlWriter As HtmlTextWriter = New HtmlTextWriter(_stringWriter)
MyBase.Render(_htmlWriter)
Dim html As String = _stringBuilder.ToString()

'the html string contains the string to the browser

writer.Write(html)
 
Back
Top