Which mechanism will be suitable for storing temporary data in Asp.net MVC? I dont want to hit to database everytime customer adds the product to cart.I read some of the articles and i am little bit confused. I want to know which mechanism would be better or any other options? 1) Cookies 2) Session 3) Text File
Asked
Active
Viewed 461 times
1 Answers
0
Sessions and cookies will be what you'll be introduced to in such a case.
Technically cookies will long more time but this is a bit less understandable.
So what a session is? It is something that starts when your user enter your site and follows him until he shuts its browser down.
To provide such a functionality the browser and the server share a token.
That's what's behind the concept of "session".
Basically session storage has a "key=>value" format so to achieve session storage you will have to use a dictionary-like interface:
HttpContext.Current.Session.Add("The Key",the_value);
the_value
can be anything serializable.

artragis
- 3,677
- 1
- 18
- 30
-
So should I use sessions for holding temporary data for such conditions? – user3624888 Mar 16 '16 at 11:06