TempData
public class HomeController: Controller{
public ActionResult Index(){
TempData["MyOriginalData"] = "Data from Index action"; // this data will preserved and available in the below action when we are redirected by below code line
return RedirectToAction("Home", "Home");
}
public ActionResult Home() {
//TempData["MyOriginalData"] is available and hence can be used in Home view
return View();
}
}<div>
My data I received from controller is:
@TempData["MyOriginalData"]
</div>Peek and Keep
Last updated