browse - don't turn back

  • Thread starter Thread starter Marcos MOS
  • Start date Start date
M

Marcos MOS

Hi there!

How Can I forbid my user to turn back the pages that he has just visited in
a browse? Is it possible?

Like, cleaning his web historic...

thanks so much
Marcos
 
This has nothing to with ASP.Net - you should try a client side group.
Having said that I doubt you can do that. I would find it pretty irritating
if client-side code wiped my history out
 
i doubt very much you can do that. you can hide the toolbar buttons though.
(you will need to open a new instance of a browser to do this though)
 
Many ways to do such. What works well for me is this....

To prevent a user from going back to page A, from page B, stick another page
in between the two when navigating, i.e. noBack.htm.

While in Page A, do a Server.Transfer to the noBack.htm page.
The light weight noBack.htm page contains nothing more than the bare html
tag minimum (e.g., html, head and body tags) and
one client side JavaScript statement:
<script>
location.href = 'pageB.aspx';
</script>

If JavaScript is disabled, then this is a problem. Since it's an ASP.NET
application, disabling JavaScript propably cripples the functionality in the
program, so you are checking this to begin with, correct?

Good luck.

Peter
 
I just want to prevent the user click in my "confirm" button and later he
can turn back the page and click again in that!...

Is it possible?

best regards,
Marcos
 
of course the history drop down or history window allow the user to bypass
this trick.

you should code your site to support double posting of the same page. the
easiest way is to store a transaction key in a hidden field, then on
postback check if already been processed.

-- bruce (sqlwork.com)
 
Sure, but the way you are doing it is probably not the best way. Try and do
it programatically like how bruce suggested in this thread.
 
of course the history drop down or history window allow the user to bypass
this trick.

Well one could add the appropriate headers to have the page expire
immediately (works well for IE) and
couple this with a client script check document.referer to bounce the user
out of the page (in my original example this would be page A). That's a
very stealth implementation already.
you should code your site to support double posting of the same page. the
easiest way is to store a transaction key in a hidden field, then on
postback check if already been processed.

That's a good idea, too, but not bulletproof. For instance, it is
problematic for using a database like MS Access/Jet as it has a caching
issue with not picking up newly inserted records, e.g. MS KB article #
245676. Perhaps for other RDBMS, but I can speak from experience with Jet.

Combining the two would be a best practice.
 
See following code that helps you know if the user arrived on your page by clicking the Back button
(This worked for me in IE)

<HTML><BODY ONLOAD="handleBackButton()"><FORM NAME="_mine"><INPUT NAME="_a1" VALUE="1" STYLE="visibility:hidden"></FORM><SCRIPT LANGUAGE="JAVASCRIPT"
var x="1"
var isBack
function handleBackButton()
isBack = (x != document._mine._a1.value)
document._mine._a1.value=2
document._mine._a1.defaultValue=2


function isBackButtonUsed()
return isBack

</SCRIPT><H1>Back button testing</H1><form><input type=button value="is back button" onclick="(isBackButtonUsed())
alert('Back button was used'):alert('Page was loaded normally')"></form></BODY></HTML>
 
You could use a Session variable whose value if is False then the User
has not clicked the Confirm button so do the processing; if 'True' then
do not do the processing.

with regards,


J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com
 
Back
Top