Library tutorials & articles

Implementing Session Tracking

Cookies

This is one of the most famous methods and the one used by almost all professional sites. This allows you complete flexibility and whatever you want as far as session tracking is concerned. But it is not as easy as the other 2 methods. Besides some applications may not allow cookies in which case you have to revert back to the other 2 methods. I had designed websites using WML (Wireless Markup Language) which worked on WAP based cell phones. Unfortunately the cellphones did not have enough memory to support cookies, so I had to use hidden fields to get session tracking working. But cookies would work on almost every every computer, except when a user may have blocked all cookies for security reasons in which case you would once again have to use either of the other 2 methods.

There will be no code here to explain cookie usage. Using cookies is probably the best and the neatest of all the methods to maintain sessions. Cookies are basically small text files that are stored on the user's computers. This has information pertaining to that user. Once the cookie is created on the user's computer then for every further request made by that user in that session, the cookie is sent along with the request. The value of every cookie is unique (for users browsing a particular website), so the server side program can differentiate between various users.

The method to program cookies is different for different languages. Most of the language provide some class that covers all the details of cookie creation and maintenance. For example in Java you have a javax.servlet.http.Cookie class that is used to work with cookies. Since I have decided to keep this article language neutral and I had not planned to discuss cookies in depth I would not go into the details of cookie programming.

Comments

  1. 21 Feb 2003 at 06:42
    In this article the author describes 2 mechanisms for session tracking. The first of these - hidden form fields is dismissed for those implementers who do not want their hidden field data to be seen by users looking at the page text. It is regarded as inferior to URL re-writing to which the author specifies a preference. So just how is the displaying of a URL in the Address box of browser with all that same information appended to it any better at 'hiding' this data? Considerably worse, I'd say !
  2. 01 Jan 1999 at 00:00

    This thread is for discussions of Implementing Session Tracking.

Leave a comment

Sign in or Join us (it's free).

Kiran Pai

Related podcasts

  • Top Web Design Mistakes

    Pete LePage is Product Manager of Internet Explorer Developer Division and he doesn’t want your web site to stink. Sharing from his talk given at TechEd 2008, Pete highlights 10 common web design mistakes and tells you how you can bypass the same blunders. Pete also tells us how future features o...

Events coming up

We'd love to hear what you think! Submit ideas or give us feedback