History Stack

Discussion in 'ASP .Net Web Controls' started by Thom Little, Mar 18, 2005.

  1. Thom Little

    Thom Little Guest

    I have an ASP 3 application that must pass control using JavaScript ...

    window.location.replace( strURL + "?result=" + strResult );

    This is done in order to maintain the History stack on the callers machine.
    My function is called the using window.location.replace( ) and my function
    uses window.location.replace( ) to return. As a result, nothing about my
    function appears on the callers History stack.

    What is the technique for returning from an ASP.NET C# webform the same way?

    --
    -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd.
    --
     
    Thom Little, Mar 18, 2005
    #1
    1. Advertising

  2. Thom Little

    Thom Little Guest

    It is apparently maintained properly by Response.Redirect( ).

    --
    -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd.
    --

    "Thom Little" <> wrote in message
    news:%...
    >I have an ASP 3 application that must pass control using JavaScript ...
    >
    > window.location.replace( strURL + "?result=" + strResult );
    >
    > This is done in order to maintain the History stack on the callers
    > machine. My function is called the using window.location.replace( ) and my
    > function uses window.location.replace( ) to return. As a result, nothing
    > about my function appears on the callers History stack.
    >
    > What is the technique for returning from an ASP.NET C# webform the same
    > way?
    >
    > --
    > -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd.
    > --
    >
    >
    >
     
    Thom Little, Mar 18, 2005
    #2
    1. Advertising

  3. Hi Thom,

    First of all, I would like to confirm my understanding of your issue. From
    your description, I understand that you need to achieve the same goal as
    window.location.replace at server side. If there is any misunderstanding,
    please feel free to let me know.

    As far as I know, we cannot achieve this at server side with C# code.
    Because when the server receive the request, it sends the response back,
    the client web browser thinks it as a new location. and will add a new
    history in the history stack.

    HTH.

    Kevin Yu
    =======
    "This posting is provided "AS IS" with no warranties, and confers no
    rights."
     
    Kevin Yu [MSFT], Mar 19, 2005
    #3
  4. Thom Little

    Thom Little Guest

    If the client calls the server with window.location.replace() and the server
    then calls the client on its return with Response.Redirect( ) then the
    server entry is never entered into the callers history and a "back arrow"
    will take the user back to the page that called the client page.

    This even works correctly when there is a query string to the server and
    another query string from the server.

    My testing with ASP 3 was throwing me off. In ASP e3 you must use
    window.location.replace( ) on both the client and the server. This was
    apparently corrected in ASP.NET.

    Getting that entry off the history stack today has been a monumental
    improvement. That annoying "cant get off this page" problem is now gone.

    --
    -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd.
    --

    "Kevin Yu [MSFT]" <> wrote in message
    news:...
    > Hi Thom,
    >
    > First of all, I would like to confirm my understanding of your issue. From
    > your description, I understand that you need to achieve the same goal as
    > window.location.replace at server side. If there is any misunderstanding,
    > please feel free to let me know.
    >
    > As far as I know, we cannot achieve this at server side with C# code.
    > Because when the server receive the request, it sends the response back,
    > the client web browser thinks it as a new location. and will add a new
    > history in the history stack.
    >
    > HTH.
    >
    > Kevin Yu
    > =======
    > "This posting is provided "AS IS" with no warranties, and confers no
    > rights."
    >
     
    Thom Little, Mar 19, 2005
    #4
  5. Hi Thom,

    If we use Response.Redirect in the page load event, we will avoid adding a
    history entry to the stack. But if we use a Redirect after the page is load
    and send to client, a post back will be send to server. Also,
    window.location.replace is only use at client side.

    Anyway, thanks for sharing your experience with all the people here. If you
    have any questions, please feel free to post them in the community.

    Kevin Yu
    =======
    "This posting is provided "AS IS" with no warranties, and confers no
    rights."
     
    Kevin Yu [MSFT], Mar 22, 2005
    #5
  6. Thom Little

    Thom Little Guest

    Thanks for the added tip. I am using Response.Redirect in page load.

    --
    -- Thom Little -- www.tlanet.net -- Thom Little Associates, Ltd.
    --

    "Kevin Yu [MSFT]" <> wrote in message
    news:...
    > Hi Thom,
    >
    > If we use Response.Redirect in the page load event, we will avoid adding a
    > history entry to the stack. But if we use a Redirect after the page is
    > load
    > and send to client, a post back will be send to server. Also,
    > window.location.replace is only use at client side.
    >
    > Anyway, thanks for sharing your experience with all the people here. If
    > you
    > have any questions, please feel free to post them in the community.
    >
    > Kevin Yu
    > =======
    > "This posting is provided "AS IS" with no warranties, and confers no
    > rights."
    >
     
    Thom Little, Mar 23, 2005
    #6
  7. You're welcome, Thom.

    Kevin Yu
    =======
    "This posting is provided "AS IS" with no warranties, and confers no
    rights."
     
    Kevin Yu [MSFT], Mar 23, 2005
    #7
    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. Surinder Singh
    Replies:
    1
    Views:
    1,250
    Richard Bos
    Dec 20, 2007
  2. Sam Stephenson
    Replies:
    1
    Views:
    261
    Andrew Walrond
    Jun 18, 2005
  3. |-|erc
    Replies:
    12
    Views:
    176
    Randy Webb
    Aug 23, 2005
  4. Replies:
    2
    Views:
    457
    nutso fasst
    Oct 17, 2006
  5. Niall
    Replies:
    3
    Views:
    195
    Niall
    Dec 6, 2006
Loading...

Share This Page