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.
source share