开发者

Disable of viewing previous page in asp.net

In my project i want to d开发者_Go百科eny going back to the page when i click back button in toolbar. How its possible in asp.net and c#. Thank you.


Just put this javascript in the html section of an aspx page above the head section.

This causes every back to return with a forward.

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

plus have a look at this article https://web.archive.org/web/20210927201700/http://www.4guysfromrolla.com/webtech/111500-1.shtml


If you want to do this by code-behind.Put following code in Page_Load or Page_Init event of the page

protected void Page_Init(object Sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
Response.Cache.SetNoStore();
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜