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

  • Thread starter Thread starter André
  • Start date Start date
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)
 
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.
 
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)
 
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
 
Back
Top