在asp.net 2.0中禁用浏览器后退按钮 [英] Disable Browser back button in asp.net 2.0

查看:94
本文介绍了在asp.net 2.0中禁用浏览器后退按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type = "text/javascript" >
function disableBackButton()
{
window.history.forward();
}
setTimeout("disableBackButton()", 0);
</script>


protected void Page_Load(object sender, EventArgs e)
   {

           Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "disableBackButton();", true);
       }


我已将此代码放在我的页面中,但是添加此页面代码后可以使用,但是它适用于网站的所有页面,因此我无法返回上一页.
我想仅在用户单击singout时禁用后退按钮,并启用剩余的所有页面.


I have put this code in my page but after adding this page code is work but it is work for all the page of the website so i am not able to get back in the previous page.
I want to disable the back button just when user click on singout and enable for remaining all the pages

推荐答案

代码已添加到母版页中.如果是这样,它将适用于所有页面,请移至内容页面.
Code is added in Master Page. if so it will apply for all the pages, please move to content page.


这篇关于在asp.net 2.0中禁用浏览器后退按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆