控制器動作當我點擊Win7的IE10中或Chrome返回按鈕,它不打我的斷點在我的MVC控制器。在IE瀏覽器開發者的工具,網絡標籤顯示它有一個304沒有修改,提琴手不捕獲請求。後退按鈕不回發到在MVC
我期待回傳,這樣我就可以在我的控制器做的工作。 在我的情況下,錯誤是:
- 登錄
- 確保您的默認頁面上
- 點擊瀏覽器頂部的登錄離開你現在會回來 後退按鈕屏幕
- 與您的憑據登錄時,會再次 做到這一點 - 我得到「提供的防僞標記是爲那些用戶‘’,而當前用戶是‘用戶名’
我試圖把這個在我的控制器,但沒有成功:
this.HttpContext.Response.CacheControl = "private";
this.HttpContext.Response.Cache.SetMaxAge(TimeSpan.FromSeconds(0));
public ActionResult Index()
{
// Get: /Home/Index
if (this.User.Identity.IsAuthenticated)
{
// send the user to the GlobalAssetDashboard
return this.RedirectToAction(
"GlobalAssetDashboard",
"Dashboard",
new
{
area = "DashboardArea"
});
}
return this.View("Login");
}
public ActionResult Login()
{
// GET: /Home/Login
if (this.User.Identity.IsAuthenticated)
{
// send the user to the GlobalAssetList
return this.RedirectToAction(
"GlobalAssetDashboard",
"Dashboard",
new
{
area = "DashboardArea"
});
}
return this.View("Login", new LoginModel());
}
有沒有辦法強制回發或檢測這一點,並導致在JavaScript刷新?或者,也許我的控制器方法實施不正確?
不太清楚,但是這是否幫助:http://stackoverflow.com/questions/5842356/asp-net-c-sharp-navigate-back-reload-page – 2013-04-30 20:19:07
幫助爲鉻:this.HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));但不是IE10。 – Aligned 2013-04-30 20:35:50