如何在登录时清除浏览器历史记录? [英] How to clear browser history when login time?
本文介绍了如何在登录时清除浏览器历史记录?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
登录页面加载时如何清除浏览器历史记录。我希望在我的应用程序初始化时清除历史记录和缓存。如果要这样做。我使用一些代码但不能正常工作
我尝试过:
how to clear browser history when login page load. i want to clear history and cache when my application is initialize.how to do it.i use some codes but not works
What I have tried:
<META Http-Equiv="Cache-Control" Content="no-cache"/>
<META Http-Equiv="Pragma" Content="no-cache"/>
<META Http-Equiv="Expires" Content="0"/>
protected void LogOut()
{
Session.Abandon();
string loggedOutPageUrl = "Logout.aspx";
Response.Write("<script language="'javascript'">");
Response.Write("function ClearHistory()");
Response.Write("{");
Response.Write(" var backlen=history.length;");
Response.Write(" history.go(-backlen);");
Response.Write(" window.location.href='" + loggedOutPageUrl + "'; ");
Response.Write("}");
Response.Write("</script>");
}
public void ClearCacheItems()
{
List<string> keys = new List<string>();
IDictionaryEnumerator enumerator = Cache.GetEnumerator();
while (enumerator.MoveNext())
keys.Add(enumerator.Key.ToString());
for (int i = 0; i < keys.Count; i++)
Cache.Remove(keys[i]);
}
推荐答案
您无法清除浏览器历史记录。
You can't clear the browser history.
这篇关于如何在登录时清除浏览器历史记录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文