Render HTML text in the Response object

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.
 
H

Hermit Dave

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
 
H

Hermit Dave

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

Regards,

Hermit Dave
 
C

Craig Deelsnyder

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.
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top