Saturday, June 04, 2005

Determining time zone a web site visitors time zone

Recently I faced a challenge to write a server side script in .NET to determine a users' time zone. This was coming from a client in UK who was having a high traffic web site and he wanted an efficient way to determine the time zone of a user. The main condition was that it could not use any client side scripting and that it had to be very efficient.

After searching the web I realized that there were no free services that provided this kind of service. There were a few that did this for a fee.

But there were a few services that provided the visitors country based on the IP of the visitor. So I went ahead and proposed a solution where the country was discovered through one of these free services or a database and then to construct a database that contained time zones and countries.

So I used the free web service at to determine the country and then used my database to discover the time zone. this solution worked perfectly.

But the client refused to accept it because it consumed a web service. He insisted that consuming the web service will eat up his band width and that it was not feasible for him. Then I was searching around and came across the GeoIP lookup database that is being used in the DotNetNuke portal. Since this was a free database, I then changed my implementation to use this.

And I used caching to improve the performance and this was accepted by my client. Thanks Official Project Base!

No comments: