471,595 Members | 1,649 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,595 software developers and data experts.

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

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
3 2043
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
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
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.

Similar topics

reply views Thread by WebHouse.Co | last post: by
1 post views Thread by Andrew | last post: by
9 posts views Thread by Steve Peterson | last post: by
2 posts views Thread by Jeronimo Bertran | last post: by
1 post views Thread by Blasting Cap | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.