Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing TempData between controllers

My question simply is, how could the TempData be passed between Different controller? Naturally, because the controller contexts are different one controller should not be able to access the tempdata in another while tempdata can be simply passed between Action Results within the context of a single controller.

But let's say the situation necessitates cross controller communication OVER TempData, and TempData would be a requirement (regardless of whether it is a good practice or bad practice), is this possible ?

like image 557
JAX Avatar asked Aug 15 '26 18:08

JAX


1 Answers

Yes it is possible since TempData is backed by SessionState. It's essentially a special case of session state with a shorter lifespan.

Here is a similar question/answer Passing data between different controller action methods

like image 132
TGH Avatar answered Aug 18 '26 05:08

TGH



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!