在c#asp.net中登录后禁用Web浏览器后退按钮

如何登录后无法用户返回上一页登录页面? 有可能吗?

在C#中尝试这个

public void disablebrowserbackbutton() { HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); HttpContext.Current.Response.Cache.SetNoServerCaching(); HttpContext.Current.Response.Cache.SetNoStore(); } 

客户端

  

登录后,在会话中保留用户的详细信息…在登录页面的pageLoad事件中检查该会话是否有任何值,如果它有任何值,则将页面重定向到Home或Index页面或登录后要加载的任何值。

在登录页面的页面中:

  string userID= (string)(Session["userID"]); if(userID!=NULL) { // code to redirect to home page } 

if(!IsPostBack){if(Session [“LoginId”] == null)Response.Redirect(“frmLogin.aspx”); else {Response.ClearHeaders(); Response.AddHeader(“Cache-Control”,“no-cache,no-store,max-age = 0,must-revalidate”); Response.AddHeader(“Pragma”,“no-cache”); }}