lock-out "Back" button

  • Thread starter Thread starter John A Grandy
  • Start date Start date
J

John A Grandy

asp.net 1.1
ie 6

how to lock-out the user from clicking the browser "Back" button ?
 
Scott M. said:
Not possible.

It is possible, with javascript, but you cannot depend on it working (user
can disable js, may not have it, etc.). Google "disable back javascript"
 
It is NOT possible with ASP.NET and (as you point out) it is not reliable in
client-side code either.
 
Yeah u could also use javascript..but that WILL not allow the user to
click the back button on the BROWSER!
But if its NOT to see the cached page then Saravana's solution should
WORK
Patrick
 
Hi Saravana.

In regards to "disabling the IE Back button" in my ASP.NET application ...

My objective is to prevent the user from seeing any of the pages previously
visited in my application -- so removing them from the cache sounds like the
correct solution.

I assume with your solution, the "Back" button stays visible on the browser?
What happens if the user clicks it? I'd prefer that the current page remain
shown.


Response.Buffer = True
Response.ExpiresAbsolute = Now().Subtract(New TimeSpan(1, 0, 0, 0))
Response.Expires = 0
Response.CacheControl = "no-cache"

Where to locate the above code? Does it have to be placed in every page?
Such as in the OnPreRender event ?

Or is there a way to implement this technique globally for my entire asp.net
application ?

Thanks.
John.
--------------

you wrote:

"Saravana" <[email protected] in message
Its not possible to do that in asp.net. If your requirement is that user
shouldnt see the cached page by clicking back button, then check out this
faq
http://www.extremeexperts.com/Net/FAQ/DisablingBackButton.aspx
 
yes, i know that it belongs in the "code-behind" (more properly the class
associated with the web-form) .... but i am attempting to locate the code in
a single location and have it apply to all pages in my application
 
Back button will be visible only if go with this approach. Advantage in this
method is, you can restrict the user from viewing cached page. You need to
place the code in each page. If you want you write handler for this stuff,
so you no need to put it in every page.
 
what is the solution so that the "Back" button actually does not appear on
the browser ?

can that solution be implemented server-side ?

i assume that solution applies only to browsers hosting the web-app in
question ...
 
Even if the button isn't visible, there is always shortcut keys like
Backspace and Alt left arrow..
 
Back
Top