ASP.NET MVC does browser refresh make TempData useless?

前端 未结 6 1187
逝去的感伤
逝去的感伤 2020-12-29 15:20

If I redirect to a new page passing TempData to initialise the page it works fine, however if the user presses the refresh button in their browser the TempData is no-longer

6条回答
  •  一个人的身影
    2020-12-29 15:55

    You should write

    TempData.Keep("nameofthedata");
    

    in your controller, then it will keep that data in refresh situations too.

提交回复
热议问题