By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,264 Members | 1,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,264 IT Pros & Developers. It's quick & easy.

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

P: n/a
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?It em0={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)

Nov 30 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net

"André" <hjhhb@ddwrote in message
news:uh*************@TK2MSFTNGP02.phx.gbl...
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?It em0={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)
Nov 30 '06 #2

P: n/a
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)
"André" <hjhhb@ddwrote in message
news:uh*************@TK2MSFTNGP02.phx.gbl...
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?It em0={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)
Dec 1 '06 #3

P: n/a
But there is a <imgtag 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


"Steve C. Orr [MCSD, MVP, CSM, ASP Insider]" <St***@Orr.netschreef in
bericht news:47**********************************@microsof t.com...
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.

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net

"André" <hjhhb@ddwrote in message
news:uh*************@TK2MSFTNGP02.phx.gbl...
>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?I tem0={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)

Dec 1 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.