I have a class. I want the object of the class to be initialized once and be available to the next page to be browsed. Is there any other way apart from Session and paramter passing thru URL that is fast, safe and accurate
Asked
Active
Viewed 46 times
1 Answers
0
The nature of the HTTP is to be stateless so you have to care about the state of your objects. You can either use the Session or the Cache keeping in mind their differences

Community
- 1
- 1

Massimiliano Peluso
- 26,379
- 6
- 61
- 70
-
but session seems to have a lot of problem http://www.4guysfromrolla.com/webtech/faq/Advanced/faq4.shtml and see Tip 6: Using the Session Object Wisely in https://msdn.microsoft.com/en-us/library/ms972335.aspx#asptips_topic7 and of course Cache is of no use to me since I need to be user specific... so I am thinking of using Cookies – Shomaail Mar 17 '15 at 11:42
-
If you do not want to use the sessions you have to create your own code to achieve it(maybe serializing/de-serializing) the object in to the Database. HTTP is stateless so there is not way to keep an object alive between requests – Massimiliano Peluso Mar 17 '15 at 11:49
-
what hav u opinion about cookie... DB reading writing is time inefficient – Shomaail Mar 17 '15 at 11:54
-
cookie are for completely other purpose. I would stick to the Session in your case. – Massimiliano Peluso Mar 17 '15 at 16:42