我的ASP.NET(Framework 4)Web項目中的導航有問題。我在主頁上有一個登錄字段。主頁面還包含一個ContentPlaceHolder,它可以動態地包含其他aspx頁面。我從頁面「a」開始並導航到頁面「b」。當我在頁面「b」上登錄時,導航中的其他節點變得可見。現在我的問題是:當我從瀏覽器中按下「歷史記錄」按鈕時,附加節點在頁面「a」上消失。導航後退和重新加載頁面
我發現頁面「a」不會再次重新加載,因爲它是從瀏覽器的緩存中加載的。
我試圖用一個LinkButton(Zurueck)的東西:
protected void Page_Load(object sender, EventArgs e)
{
Zurueck.Attributes.Add("onClick", "javascript:history.back(); return false;");
}
我也試圖與緩存限制,一些在C#源和ASPX來源:
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
if (Session["sessionKuerzel"] != null)
{
view = (TreeView)this.FindControl("TreeViewVerwaltung");
view.Visible = true;
login = (Button)this.FindControl("Senden");
login.Visible = false;
logout = (Button)this.FindControl("Logout");
logout.Visible = true;
benutzerrecht = (string)(Session["sessionRecht"]);
if (benutzerrecht.Equals("Administrator")){
view.Nodes[0].ChildNodes[1].SelectAction = TreeNodeSelectAction.Select;
}
else{
view.Nodes[0].ChildNodes[1].SelectAction = TreeNodeSelectAction.None;
}
view.Visible = true;
}
}
Site.Master.aspx(頭):
<meta http-equiv="cache-control" content="no-cache"/>
<meta http-equiv="expires" content="0"/>
但所有這些替代方案不適用於Mozilla FireFox。
如何導航回曆史&重新加載頁面?任何想法或解決方案?
我相信你必須使用一個負到期時間,使其正常工作。 – 2011-04-30 21:48:28