In ASP.NET MVC, there's a TempData which can pass data one time from one page to another. What's the equivalent for this in ASP.NET?
Asked
Active
Viewed 3,365 times
8
-
Session and Viewstate bai Rob :D – Carls Jr. Jun 01 '11 at 11:17
2 Answers
6
There is no direct equivalent (that is, data that is only passed to the next page).
You can use Session
and clear it out on the receiving page.

Oded
- 489,969
- 99
- 883
- 1,009
-2
You can use either Session or Viewstate to pass data between pages in ASP.NET application.

eugeneK
- 10,750
- 19
- 66
- 101
-
4
-
I suggest you read the article. He is using [`Server.Transfer`](http://msdn.microsoft.com/en-us/library/ms525800.aspx). This is not the same a loading a new page or doing a redirect. – Oded Jun 01 '11 at 08:35
-
Oded, will it do what @rob waminal asks for or not. I'm not discussing about Responce.Redirect versus Server.Transfer when in this case you right they are different. – eugeneK Jun 01 '11 at 08:39
-
@eugeneK: I'll be passing some query strings to the called page so Server.Transfer is a no. – rob waminal Jun 01 '11 at 09:59
-
Then you can save in Cache and Application but this will be global to all application users, so use Session for user specific data. – eugeneK Jun 01 '11 at 11:26