simple question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tina

    #1

    simple question

    I have page1.aspx and page2.aspx.

    Lets say page1 has a hyperlink to page2. If the user clicks on that
    hyperlink Page two will be displayed either in a new window or the same
    window(dependin g on which way I want it).

    Now, I want exactly the same behavior to occur except that I don't want to
    use a hyperlink. I want to put a button on page1 and when the user pushes
    the button my code behind that button will decide if page2 should display or
    not. But if it does decide that page2 should display, the behavior should
    be exactly as if a hyperlink were used.

    I can't seem to figure out how to do this. I read, here on this forum, that
    server.transfer would do it but that does not work - the page1 url is still
    displayed.

    How can I do this?
    Thanks,
    T


  • S. Justin Gengo

    #2
    Re: simple question

    Tina,

    Here's how Response.Redire ct and Server.Transfer work:

    Response.Redire ct - A user requests a web page. They click a button on the
    page and a request is sent back to the server. The server sees code that
    says, "Perform a response.redire ct to page 2." The server sends the user's
    computer the instruction to go to page 2, the users computer requests page 2
    (they see page 2 in their address bar).

    Server.Transfer - A user requests a web page. They click a button on the
    page and a request is sent back to the server. The server sees code that
    says, "Perform a server.transfer to page 2." The server gets page 2 and
    sends it to the user's computer instead of page 1. The user's address bar
    never changes because their computer doesn't know that it's page two that
    was sent instead of page 1.

    The code you are using is sending the user to page 2, it's just that it cuts
    out the middleman so to speak and doesn't bother with making the user's
    computer request page 2.

    I hope this helps.

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    www.aboutfortunate.com

    "Out of chaos comes order."
    Nietzche
    "Tina" <tinamseaburn@e xcite.com> wrote in message
    news:uhMRC2sWDH A.2272@TK2MSFTN GP11.phx.gbl...[color=blue]
    > I have page1.aspx and page2.aspx.
    >
    > Lets say page1 has a hyperlink to page2. If the user clicks on that
    > hyperlink Page two will be displayed either in a new window or the same
    > window(dependin g on which way I want it).
    >
    > Now, I want exactly the same behavior to occur except that I don't want to
    > use a hyperlink. I want to put a button on page1 and when the user pushes
    > the button my code behind that button will decide if page2 should display[/color]
    or[color=blue]
    > not. But if it does decide that page2 should display, the behavior should
    > be exactly as if a hyperlink were used.
    >
    > I can't seem to figure out how to do this. I read, here on this forum,[/color]
    that[color=blue]
    > server.transfer would do it but that does not work - the page1 url is[/color]
    still[color=blue]
    > displayed.
    >
    > How can I do this?
    > Thanks,
    > T
    >
    >[/color]


    Comment

    • Tina

      #3
      Re: simple question

      S.,
      Thanks for that clear and concise answser, I changed my Server.Transfer to a
      Response.Redire ct and the page now has the url of the correct asp page.
      What I am actually doing in that page is the following:

      Response.Conten tType = "image/jpeg"
      myBigImage.Save (Response.Outpu tStream, ImageFormat.Jpe g)

      The Image its writing out to the page just fine but the user can't save it
      as a jpg. I'm trying to duplicate the functionality that we used to do when
      we had an href=myfile.jpg ; target="_blank" . the user got a brand new window
      with a .jpg file that could be easily be saved.

      Do you have any idea how I can duplicate this functionality from vb.net
      code?

      Thanks,

      T
      "S. Justin Gengo" <sjgengo@aboutf ortunate.com> wrote in message
      news:%2336cP9sW DHA.1204@TK2MSF TNGP12.phx.gbl. ..[color=blue]
      > Tina,
      >
      > Here's how Response.Redire ct and Server.Transfer work:
      >
      > Response.Redire ct - A user requests a web page. They click a button on the
      > page and a request is sent back to the server. The server sees code that
      > says, "Perform a response.redire ct to page 2." The server sends the user's
      > computer the instruction to go to page 2, the users computer requests page[/color]
      2[color=blue]
      > (they see page 2 in their address bar).
      >
      > Server.Transfer - A user requests a web page. They click a button on the
      > page and a request is sent back to the server. The server sees code that
      > says, "Perform a server.transfer to page 2." The server gets page 2 and
      > sends it to the user's computer instead of page 1. The user's address bar
      > never changes because their computer doesn't know that it's page two that
      > was sent instead of page 1.
      >
      > The code you are using is sending the user to page 2, it's just that it[/color]
      cuts[color=blue]
      > out the middleman so to speak and doesn't bother with making the user's
      > computer request page 2.
      >
      > I hope this helps.
      >
      > --
      > S. Justin Gengo, MCP
      > Web Developer
      >
      > Free code library at:
      > www.aboutfortunate.com
      >
      > "Out of chaos comes order."
      > Nietzche
      > "Tina" <tinamseaburn@e xcite.com> wrote in message
      > news:uhMRC2sWDH A.2272@TK2MSFTN GP11.phx.gbl...[color=green]
      > > I have page1.aspx and page2.aspx.
      > >
      > > Lets say page1 has a hyperlink to page2. If the user clicks on that
      > > hyperlink Page two will be displayed either in a new window or the same
      > > window(dependin g on which way I want it).
      > >
      > > Now, I want exactly the same behavior to occur except that I don't want[/color][/color]
      to[color=blue][color=green]
      > > use a hyperlink. I want to put a button on page1 and when the user[/color][/color]
      pushes[color=blue][color=green]
      > > the button my code behind that button will decide if page2 should[/color][/color]
      display[color=blue]
      > or[color=green]
      > > not. But if it does decide that page2 should display, the behavior[/color][/color]
      should[color=blue][color=green]
      > > be exactly as if a hyperlink were used.
      > >
      > > I can't seem to figure out how to do this. I read, here on this forum,[/color]
      > that[color=green]
      > > server.transfer would do it but that does not work - the page1 url is[/color]
      > still[color=green]
      > > displayed.
      > >
      > > How can I do this?
      > > Thanks,
      > > T
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • S. Justin Gengo

        #4
        Re: simple question

        Tina,

        Sorry, but I haven't worked at saving images dynamically as of yet. I really
        have no idea where to start with that.

        :(

        Sincerely,

        --
        S. Justin Gengo, MCP
        Web Developer

        Free code library at:
        www.aboutfortunate.com

        "Out of chaos comes order."
        Nietzche
        "Tina" <tinamseaburn@e xcite.com> wrote in message
        news:eLu6e5tWDH A.1888@TK2MSFTN GP10.phx.gbl...[color=blue]
        > S.,
        > Thanks for that clear and concise answser, I changed my Server.Transfer to[/color]
        a[color=blue]
        > Response.Redire ct and the page now has the url of the correct asp page.
        > What I am actually doing in that page is the following:
        >
        > Response.Conten tType = "image/jpeg"
        > myBigImage.Save (Response.Outpu tStream, ImageFormat.Jpe g)
        >
        > The Image its writing out to the page just fine but the user can't save it
        > as a jpg. I'm trying to duplicate the functionality that we used to do[/color]
        when[color=blue]
        > we had an href=myfile.jpg ; target="_blank" . the user got a brand new[/color]
        window[color=blue]
        > with a .jpg file that could be easily be saved.
        >
        > Do you have any idea how I can duplicate this functionality from vb.net
        > code?
        >
        > Thanks,
        >
        > T
        > "S. Justin Gengo" <sjgengo@aboutf ortunate.com> wrote in message
        > news:%2336cP9sW DHA.1204@TK2MSF TNGP12.phx.gbl. ..[color=green]
        > > Tina,
        > >
        > > Here's how Response.Redire ct and Server.Transfer work:
        > >
        > > Response.Redire ct - A user requests a web page. They click a button on[/color][/color]
        the[color=blue][color=green]
        > > page and a request is sent back to the server. The server sees code that
        > > says, "Perform a response.redire ct to page 2." The server sends the[/color][/color]
        user's[color=blue][color=green]
        > > computer the instruction to go to page 2, the users computer requests[/color][/color]
        page[color=blue]
        > 2[color=green]
        > > (they see page 2 in their address bar).
        > >
        > > Server.Transfer - A user requests a web page. They click a button on the
        > > page and a request is sent back to the server. The server sees code that
        > > says, "Perform a server.transfer to page 2." The server gets page 2 and
        > > sends it to the user's computer instead of page 1. The user's address[/color][/color]
        bar[color=blue][color=green]
        > > never changes because their computer doesn't know that it's page two[/color][/color]
        that[color=blue][color=green]
        > > was sent instead of page 1.
        > >
        > > The code you are using is sending the user to page 2, it's just that it[/color]
        > cuts[color=green]
        > > out the middleman so to speak and doesn't bother with making the user's
        > > computer request page 2.
        > >
        > > I hope this helps.
        > >
        > > --
        > > S. Justin Gengo, MCP
        > > Web Developer
        > >
        > > Free code library at:
        > > www.aboutfortunate.com
        > >
        > > "Out of chaos comes order."
        > > Nietzche
        > > "Tina" <tinamseaburn@e xcite.com> wrote in message
        > > news:uhMRC2sWDH A.2272@TK2MSFTN GP11.phx.gbl...[color=darkred]
        > > > I have page1.aspx and page2.aspx.
        > > >
        > > > Lets say page1 has a hyperlink to page2. If the user clicks on that
        > > > hyperlink Page two will be displayed either in a new window or the[/color][/color][/color]
        same[color=blue][color=green][color=darkred]
        > > > window(dependin g on which way I want it).
        > > >
        > > > Now, I want exactly the same behavior to occur except that I don't[/color][/color][/color]
        want[color=blue]
        > to[color=green][color=darkred]
        > > > use a hyperlink. I want to put a button on page1 and when the user[/color][/color]
        > pushes[color=green][color=darkred]
        > > > the button my code behind that button will decide if page2 should[/color][/color]
        > display[color=green]
        > > or[color=darkred]
        > > > not. But if it does decide that page2 should display, the behavior[/color][/color]
        > should[color=green][color=darkred]
        > > > be exactly as if a hyperlink were used.
        > > >
        > > > I can't seem to figure out how to do this. I read, here on this[/color][/color][/color]
        forum,[color=blue][color=green]
        > > that[color=darkred]
        > > > server.transfer would do it but that does not work - the page1 url is[/color]
        > > still[color=darkred]
        > > > displayed.
        > > >
        > > > How can I do this?
        > > > Thanks,
        > > > T
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        Working...