Creating a new sessionThe first time a new user visits a page on your site a new session is automatically created. How? Well, in answering that we'll discover the major limitation of the Session object - it relies on cookies.If you don't know already, cookies are simply data stored on your computer and automatically sent to the server by browsers when requesting a page. (Incidentally, they are perfectly safe. They can't collect personal information from your computer like some think. Read more about privacy and cookies.) So the first time a user visits, there's no cookie and the server creates a new session and sets a cookie with a unique value. As the user browses your site the cookie is sent back and forth between your computer and the server, allowing the server to recognise the user. To your ASP page it's a transparent process. In case you're interested, here's the actual cookie we're sending back and forth right now: undefined Unless you have cookies disabled, or are using a browser that doesn't support them, you should see something like ASPSESSIONID followed by a lot of gibberish. That's the unique value I was telling you about, and how the server recognises you as an earlier visitor. Disabling sessionsIf you don't want to track sessions (and if you're not storing any data in the Session object, you don't) disable them. Your server will appreciate it since it won't have the overhead of managing all those cookies. Add this line to the top of your pages:| <%@ EnableSessionState=False %> |
Part 3: Tracking new sessions... |