|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Managing Browser History
ASP.NET AJAX enables you add entries to a browser's history stack that are linked to a specific state of a Web page, such as the state that is created by an asynchronous postback.
Browser history support requires ASP.NET 3.5 Service Pack 1 or a later release.
An AJAX-style Web page can interact with the server by using asynchronous requests. This enables users to perform many tasks without navigating away from the Web page, and it makes the Web application feel more like a locally installed application.
When users click the browser's Back button, they might expect to return the Web application to a previous state (for example, the state before the most recent asynchronous postback). However, by default, the browser unloads the page and returns to the previous Web page, independent of any asynchronous requests. Frequently this is not what the user intended.
An AJAX-style page can also involve browser-based (client) interaction without any server interaction. As with asynchronous postbacks, these actions could cause changes in the application that logically are points where users want to return when they click the Back button.
In these cases, you can manage browser history, and by extension manage the Back and Forward buttons, to provide a more logical and natural navigation model in the Web application. As the page developer, you can control the state that is required to re-create the page. You can manage history navigation in both server and client code. You do this by defining points in your application that behave like bookmarks, referred to as history points, that users return to when they navigate with the Back and Forward buttons.