TempData becomes null after page refresh

I used TempData to transfer data from action to another, but when I refresh the page, the TempData value becomes zero, how can I solve this problem? Thanks,

+6
source share
1 answer

Use Session instead of TempData . It is assumed that TempData will be used for only one redirect. Another possibility is to call the Keep method inside the controller action in which you use the value from TempData. Thus, if the user refreshes the page by pressing F5, TempData will be saved for another request.

+12
source

Source: https://habr.com/ru/post/918969/


All Articles