Home > DeveloperSection > Forums > What is the difference between cookies and session?
Anurag Sharma
Anurag Sharma

Total Post:40

Points:280
Posted on    October-11-2010 8:17 AM

 ASP.Net ASP.Net 
Ratings:


 1 Reply(s)
 1196  View(s)
Rate this:

What is the difference between cookies and session?
please provide me any sample of code and concept.

Thanks, Anurag



Alex R
Alex R

Total Post:40

Points:280
Posted on    October-11-2010 8:44 AM

Hi Anurag,

The main difference between cookies and sessions is that cookies are stored in the user's browser, and sessions are not.

A session is available as long as the browser is opened while A cookie can keep information in the user's browser until deleted.

User can block cookies or delete them at any time while Sessions are not reliant on the user allowing a cookie. They work instead like a token allowing access and passing information while the user has their browser open.

For creating cookies you can read this link.
http://www.mindstick.com/Articles/c4e253f5-67dc-4211-8a1f-e29c17ce2943/

For details about creating and using Session visit this link.
http://www.mindstick.com/Articles/273b0c21-a027-46ec-8c84-ad4e05c62b23/


Don't want to miss updates? Please click the below button!

Follow MindStick