Devi
Devi

Reputation:

How to disable the back button after Session has destroyed?

I want that after Logging Out any user should not be able to go to the Back Page. How can i do that?

Upvotes: 1

Views: 2720

Answers (4)

Canavar
Canavar

Reputation: 48088

Clear the cache instead, it's more reliable.

Add these to your header section of the page :

<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<META HTTP-EQUIV="EXPIRES" CONTENT="0">

And add this to your page load :

Response.Cache.SetCacheability(HttpCacheability.NoCache);

Upvotes: 2

Ratnesh Maurya
Ratnesh Maurya

Reputation: 706

AFAIK, you can not disable back button of web browser.

Add the following

"if user is logged in"

<% Response.CacheControl = "no-cache" %>
<% Response.AddHeader "Pragma", "no-cache" %>
<% Response.Expires = -1 %>

Upvotes: 0

danish
danish

Reputation: 5600

Disabling the back button is not possible, perfectly. So you can:

  1. Close the window on Log off.
  2. On each page, check for a valid session and if not found, redirect to login page.

Upvotes: 0

Fredrik Leijon
Fredrik Leijon

Reputation: 2802

You could try setting no-cache on the pages viewed by authenticated users, that should requier the users browser to reload the page from the server.

Upvotes: 0

Related Questions