How Session variables work
Tutorials Shared by the Internet Community
Total Hits - 29362
Total Votes - 101 votes
Vote Up - 43 votes
Vote Down - 58 votes
Domain - coveryourasp.com
Category - ASP/Cookies and Sessions
Submitted By - Devesh Khanna
Submitted on - 2008-03-06 09:03:23
This article follows on from my earlier article about Application variables, and how they allow you to store "global" data for use by all your pages.
The crucial difference between Application and Session variables is that Session variables are specific to each visitor to your site.
Background: The stateless web
The problem that Session variables have to overcome is that the HTTP protocol that you use to browse the web is stateless. Each request for a page is completely independant of earlier requests, so if you want subsequent pages to "remember" the users name that he entered on your front page you have to store that information somewhere.
This remembering of user-specific data is called "maintaining state". We'll see next how the ASP Session object can help us do just that. More detail...