ASP.NET MVC does browser refresh make TempData useless?

前端 未结 6 1152
逝去的感伤
逝去的感伤 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 16:13

    The only features that can solve your issue is Cache and Session.

    ViewData essentially 'dies' out when the view is generated.

    If you can provide more details on what you're trying to accomplish, maybe another solution can be given, however, it seems the best option for you is to use Session or Cache.

提交回复
热议问题