Why do bookmarks behave badly on ASPX pages in ASP.NET?
Posted: Mon Jan 24, 2005 3:02 pm
BB
Regular
Joined: Jun 23, 2004
Posts: 340
You have built an ASP.NET application site using Visual Studio .NET and Visual Basic .NET. You have a page which updates itself based upon data entered on that same page. For example a database search that returns results based on the search criteria. Now users are complaining that they cannot bookmark those search results! What is the deal? Also, the back button does not seem to go back!
ASP.NET changed the way we think about navigation on the web. Most of the functionality allowed by ASP.NET comes from the method of POSTing back to the same page in order to run server-side code. The first and most annoying issue realized from this method is the loss of client scroll position on each postback.
Microsoft has a feature called SmartNavigation that can be enabled on a page level in the Page directive of the ASPX file, or at application in the Web.config file. But read on, it may not fit the bill for you. It did not help in my situation where users want to bookmark.
Here is the [url=http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemWebUIPageClassSmartNavigationTopic.asp]MSDN article Page.SmartNavigation Property[url] from the .NET Framework class library.
When a page is requested by an Internet Explorer 5.5 browser, or later, smart navigation enhances the user's experience of the page by performing the following:
- eliminating the flash caused by navigation.
- persisting the scroll position when moving from page to page.
- persisting element focus between navigations.
- retaining only the last page state in the browser's history.
Smart navigation is best used with ASP.NET pages that require frequent postbacks but with visual content that does not change dramatically on return. Consider this carefully when deciding whether to set this property to true.
The problem mainly stems from the fact that most ASP.net (VB.NET and C#.NET) pages get built with Form method="POST". This means that bookmarking the page will not work, because a bookmark only saves a URL or URI. With a "GET" method, all the necessary parameters are present. With a "POST" method, they are all built into the form.
For METHOD="GET" the form data is encoded into a URL (or, speaking more generally, into a URI). This means that an equivalent to a form submission can be achieved by following a normal link referring to a suitable URL; see the document Choices in HTML forms for details and examples. On a typical browser, the user sees the URL of a document somewhere (e.g. on Location line), and if he is viewing the results of a query sent using METHOD="GET", he will see what the actual query was (i.e. the part of the URL that follows the ? sign). The user could then bookmark it or cut&paste it for later use (e.g. to be E-mailed or put into one's own HTML document after some editing).
You need to remind your users that a complex web application works much the way the old desktop application did. And on desktop applications, there is no back button and there is no bookmarking!
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest (c) 2006 by Group29 Productions.
You can syndicate Group29 Productions news with an RSS Feeder using the file backend.php