Reputation: 13
what is the life of a controller? if i create a controller, store some data in private fields, then the user goes to other pages using different controllers, then clicks a link to come back to the original controller, under which circumstances will that data still be there?
thanks!
Upvotes: 1
Views: 168
Reputation: 13536
This is a great cheat sheet for the asp.net mvc lifecycle. Click the image for the original PDF.
alt text http://techposters.net/uploads/images/b/6/5/2/1/3ec799186e.gif
Upvotes: 3
Reputation: 116987
The controller is instantiated and destroyed by the MVC framework for each HTTP request.
If you need to persist data between page requests, use Session, or store it in a database.
Upvotes: 2