What is TempData in MVC?

devquora
devquora

Posted On: Feb 22, 2018

 

    1 Answer Written

  •  devquora
    Answered by Priyag Chaudhary

    TempData in MVC is a dictionary object to store data temporarily. It is a TempDataDictionary class type and instance property of the Controller base class.

    TempData can keep data for the duration of an HTTP request; in other words, it can keep live data between two consecutive HTTP requests. It will help us to pass the state between action methods. TempData only works with the current and subsequent requests. TempData uses a session variable to store the data. TempData Requires typecasting when used to retrieve data.

Related Questions

Please Login or Register to leave a response.

Related Questions

MVC interview questions

What is MVC (Model view controller)?

 Model–view–controller (MVC) is a software architectural pattern for implementing user interfaces. It divides a giv..

MVC interview questions

What is Razor in MVC?

 ASP.NET MVC has always supported the concept of “view engines” – which are the pluggable modules, which practica..

MVC interview questions

Explain attribute based routing in MVC?

 In ASP.NET MVC 5.0 we have a new attribute route,by using the “Route” attribute we can define the URL structure. F..