problem with rendering page using 'Response.Redirect' and 'Response.OutputStream'

A

André

Hi,

I want to include a graphic made in file2 into file. File must first send a
value to file2 (with Response.Redirect) which will be used for the graphic.
My problem is that only the graphic is rendered and not the content of
file1.

Thanks for help.
André


See how i did:


file1:
-----
Dim lit As LiteralControl
Dim frm As HtmlForm = Me.FindControl("form1")
Dim l As New Label
l.Text = "this is the graphic"
frm.Controls.Add(l)

Response.Redirect(String.Format("redirect2.aspx?Item0={0}", 25))
lit = New LiteralControl("<img src=""redirect2.aspx""/>")
frm.Controls.Add(lit)


file2 (redirect2.aspx):
----------------------
Dim item0 As String
item0 = Request.QueryString("Item0")

Dim objBitmap As New Bitmap(200, 104)
Dim objGraphic As Graphics = Graphics.FromImage(objBitmap)
Dim redBrush As New SolidBrush(Color.Red)
.....

Response.ContentType = "image/gif"
objBitmap.Save(Response.OutputStream, ImageFormat.Gif)
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

Andre, I thought we'd already resolved this.
You must use an img tag to refer to the other page.
Response.Redirect will not work.
 
B

bruce barker

a redirect send a redirect header to the browser, which then does a new
request. you can not send content and a redirect. by default asp.net stops
running code (by aborting the thread) after sending the redirect header.

-- bruce (sqlwork.com)
 
A

André

But there is a <img> tag refering to the other page in my code.

Now my problem is then: how to pass data to the graphic from page 1 and
getting the graphic back into page 1?
I used 'redirect' because in another thread in this group, they adviced me
to use 'redirect' to pass data to another page instead of cookies ...

Thanks again
 

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,756
Messages
2,569,533
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top