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

Discussion in 'ASP .Net' started by André, Nov 30, 2006.

  1. André

    André Guest

    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)
     
    André, Nov 30, 2006
    #1
    1. Advertising

  2. 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@dd> wrote in message
    news:uhUT$...
    > 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)
    >
    >
    >
     
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider], Nov 30, 2006
    #2
    1. Advertising

  3. André

    bruce barker Guest

    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@dd> wrote in message
    news:uhUT$...
    > 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)
    >
    >
    >
     
    bruce barker, Dec 1, 2006
    #3
  4. André

    André Guest

    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




    "Steve C. Orr [MCSD, MVP, CSM, ASP Insider]" <> schreef in
    bericht news:...
    > 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@dd> wrote in message
    > news:uhUT$...
    >> 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)
    >>
    >>
    >>

    >
     
    André, Dec 1, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mboyda

    OutputStream the redirect

    mboyda, Dec 19, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    367
    mboyda
    Dec 19, 2003
  2. 1
    Replies:
    2
    Views:
    464
    bruce barker
    Jan 27, 2004
  3. claudia villatoro via .NET 247

    Response.OutputStream in a new page

    claudia villatoro via .NET 247, May 27, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    4,230
    Bruce Barker
    May 27, 2005
  4. Replies:
    2
    Views:
    3,608
  5. Sal
    Replies:
    1
    Views:
    546
Loading...

Share This Page