How to clear Navigation history in the Browser


  • Hi, I've done one silverlight web application(MVVM).After the user logins when navigates from one page to another , he can be able to go back/forward using the Back/Forward buttons present on the Browser.My requirement is once he signs-out, if he clicks on Back button he should not be able to navigate to the selected page, inturn he should be forwarded to the Login page only.

    Please give me some solution.

    Thanks & Regards,


    Monday, September 06, 2010 2:34 AM


  • Hi Ramana. There is no way to clear the user's browser history. At least no reliable way (I've seem some nasty attempts but most fail at least in some browsers).

    However. Whenever someone asks a question like this, I recommend taking a step back and look at the problem differently. If you really could clear the navigation history for your users, what will you gain? Angry users, probably, but not more. If a user wants to go back to a page he had visited before he came to your page, and he can't because you cleared the history, your application won't make a very good impression. And in addition, you cannot stop your users to go to a previous page by clearing their navigation history, because the URLs to those pages will be stored in the normal history too (the visited pages). They simply can select them from their history.

    So you should rather ask yourself what it is you want to achieve? Security? Data consistency? The solution to these problems is to add checks to each of your pages (which need a logged in user) to see whether the client really is logged in, and redirect to the login page if not. See the difference? When you do that check on the server (or/and in addition in a rich client like Silverlight), you have both a secure application because the user is not able to circumvent that mechanism, and also a consistent behavior, because you do not have to fear that in some browser (or browser version) your mechanism won't work, as it often is the case with hacky client-side java script solutions.

    Monday, September 06, 2010 4:45 AM