Friday, November 24, 2017

Difference Between TempData and Session

1. TempData allow us to persisting data for the duration of single subsequent request.
Session is able to store data much more long time, until user session is not expire.

2. TempData valid for only current and subsequent request only
Session valid for all requests.

3. TempData has Keep method to retention the value of TempData.

Example

TempData.Keep()

For Specific

TempData.Keep(“EmpName”)

4. TempData internally stored the value in to Session variable.
Session varible are stored in SessionStateItemCollection object (Which is exposed through the HttpContext.Session property of page).

No comments:

Followers

Link