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.

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“If debugging is the process of removing software bugs, then programming must be the process of putting them in.” - Edsger Dijkstra