当我在 IE10 或 Win7 上的 Chrome 中单击后退按钮时,它不会在我的 MVC 控制器中达到我的断点。IE 开发人员工具中的网络选项卡显示它有一个 304 未修改,并且 Fiddler 没有捕获请求。
我期待回复,所以我可以在我的控制器中工作。就我而言,错误是:
- 登入
- 确保您在默认页面上
- 单击左上角的浏览器后退按钮,您现在将返回登录屏幕
- 执行此操作时再次使用相同的凭据登录 - 我得到“提供的防伪令牌用于用户”,但当前用户是“用户名”。
我试过把它放在我的控制器中,但没有成功:
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 刷新?或者我的控制器方法实施不正确?