views:

86

answers:

2

I have a integer stored in TempData, and it is getting periodically wiped for an unknown reason after 30-60 seconds of browsing around my site.

I have a break point on the place where the value is set and its never being set to null, yet somehow that value in TempData is getting nulled.

Any idea why this is happening?

+5  A: 

From ASP.NET MVC: Building Web Apps without Web Forms:

TempData is a dictionary, much like the untyped ViewData. However, the contents of TempData only live for a single request and then they're deleted.

Andrew Hare
+2  A: 

I believe TempData only persists for the subsequent request. You might want to have a look at this.

Paddy