TempData is a bucket in which you can dump data that is needed only for the next request. That is, everything that you put in TempData is discarded after the completion of the next request. This is useful for one-time messages, such as form validation errors. It is important to note that this applies to the next request in the session, so the request may occur in another browser window or tab.
To answer your specific question: there is no right way to use it. All this is up to convenience and convenience. If it works, it makes sense, while others understand it relatively easily, that’s good. In your particular case, passing a parameter this way is fine, but it is strange that you need to do this (smell of code?). I would prefer to store that value in resources (if it's a resource) or in a database (if it's a constant value). From your use, this seems like a resource, as you use it for the page title.
Hope this helps.
Display Name Sep 14 2018-12-14T00: 00Z
source share