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

前端 未结 2 944
轮回少年
轮回少年 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()
    {
      ...
    }
    

提交回复
热议问题