Click here to Skip to main content
14,974,076 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Disable Browser Back Button and Forword button in ASP.NET
Posted

Try this:

JavaScript
<script type="text/javascript">
    window.history.forward();
    function noBack() { window.history.forward(); }
</script>

<body  onload="noBack();">
    onpageshow="if (event.persisted) noBack();" onunload=""></body>
   
v3
Hello,

You need to force the cache to expire for this to work.
Place the following code on your page code behind.
C#
Page.Response.Cache.SetCacheability(HttpCacheability.NoCache)

But this is a bad practice ...
   
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900