How to refresh ASP .NET MVC page when hitting browser back button

前端 未结 2 898
轮回少年
轮回少年 2021-02-07 21:11

I just found that when I click browser back button on any ASP .NET MVC page nothing happens and page is not going be updated. And only if you click F5 it will be updated only.<

相关标签:
2条回答
  • 2021-02-07 21:57

    Here is a proper solution http://dotscrapbook.wordpress.com/2011/02/02/handling-a-browser-back-button-press-with-mvc/.

    [HttpGet]
    [OutputCache(NoStore = true, Duration = 0, VaryByParam = "None")] 
    public ActionResult MyView()
    {
      ...
    }
    
    0 讨论(0)
  • 2021-02-07 22:02

    try this:

    window.onbeforeunload = function() { location.reload(); };
    
    0 讨论(0)
提交回复
热议问题