Here's the sample code that works
I tried many many many things on different websites. It never worked. Finally I wrote this code which works,
Here's how it works. you need to greate a dummy page say "somepage.aspx" this page has no content only a redirect.
This is the code below that worked for me. please not somepage.aspx canoot have any other functionality other then
just preventing backbutton press.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
<html xmlns="http://www.w3.org/1999/xhtml" >
window.location = "Default.aspx"
<body onLoad="setTimeout('delayer()', 500)">
<form id="form1" runat="server">
I want to disable the browser back button when the LOGOUT operation is performed
in my .aspx page by the user.For this i have replaced the body tag as
<body onload="if(history.length>0) history.go(+1)"<
it can also be acheived using the
it is working good for me ,but still i have a problem.
As i have set the logout operation in a master page the browser back nutton is disabled
for every page associated with the master page.It is because the body tag onload command
is executed for ever page associated with the master page.
I only need to execute the onload operation only when the logoout is performed.
I have tried to replace the body tag onload in the logout operation.
In my logout button click i have written the following code
Protected Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Session("User") = 0
Dim mybodytag As HtmlGenericControl
mybodytag = Page.Master.FindControl("Master")
I have tried it for both onload an unload operations.
But it doesn't work for me.
If you kow the answer or any other alternative solutions
pls solve it.