Render HTML text in the Response object

  • Thread starter Thread starter Paul Turley
  • Start date Start date
P

Paul Turley

I have a string (or byte array) containing an entire page definition not
contained in a file ("<htm><head>...</head><body>...</body></html>") that I
need to render when the user clicks a button. Can I send this string to the
Reponse object? This "page" is the response.

FYI, this is the content returned by the SQL Reporting Services web service.
 
Hi,
Hope you are not making fun.

If you have it as a string or a byte array and need to return it as the
response.
1. You will have to set Response.Buffer = true (so that no response is sent
to the client)
2. After you have the string or the byte array, do a Response.clear( ) to
clear up any stuff
3. Response.ContentType = "text/html"
4. Response.Write(string)
5. Response.fluch( )
6. You can explicitly call Response.End to signal the end of response

Chao for now,

Hermit Dave
 
if you have the data in byte[], then use
Response.BinaryWrite(yourDataByteArray)

Regards,

Hermit Dave
 
Paul said:
I have a string (or byte array) containing an entire page definition not
contained in a file ("<htm><head>...</head><body>...</body></html>") that I
need to render when the user clicks a button. Can I send this string to the
Reponse object? This "page" is the response.

FYI, this is the content returned by the SQL Reporting Services web service.

I find the simplest solution is to override the Render method/event of
the page, and in there write out the string you have (and don't call
your parent class's Render method). So you'll have to pry put the
string in a pageclass-level variable to get it inside Render.
 
Back
Top