History Stack

T

Thom Little

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?
 
K

Kevin Yu [MSFT]

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."
 
T

Thom Little

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.
 
K

Kevin Yu [MSFT]

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."
 
K

Kevin Yu [MSFT]

You're welcome, Thom.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,534
Members
45,007
Latest member
OrderFitnessKetoCapsules

Latest Threads

Top