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.

Note

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.

In This Section

Managing Browser History Using ASP.NET Server Controls

Managing Browser History Using Client Script

See Also

Concepts

Adding AJAX and Client Capabilities Roadmap