If you want to restrict the user to go back or forward from the web browser, you can use the below mentioned javascript. Use this javascript in the script tag. It works on all browsers.

For further details:

http://dotnetbypulikesi.blogspot.com

function defeatIE()
{
if (document.all)
{
(message);return false;
}
}
function defeatNS(e)
{
if
(document.layers||(document.getElementById&&!document.all))
{
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{
document.captureEvents(Event.MOUSEDOWN);document.onmousedown=defeatNS;
}
else
{
document.onmouseup=defeatNS;document.oncontextmenu=defeatIE;
}
document.oncontextmenu=new Function("return false")
function preventBack()
{
window.history.forward();
}
setTimeout("preventBack()", 0);
window.onunload=function(){null};