Author: sumithaswar | Posted on: 2/6/2009 11:23:11 AM | Views : 461

I am using asp.net 2.0 and c#
I want to implement hit counter for my website, and want to display this on my homepage,I have tried to implement this as follows
having a txt file in the bin directory for storing the count, and the following code in global.asax.cs

public void Session_OnStart()
        {
            try
            {
                string counter = File.ReadAllText(Server.MapPath("bin\\Visitors.txt"));

                File.WriteAllText(Server.MapPath("bin\\Visitors.txt"), Convert.ToString(Convert.ToInt32(counter) + 1));

            &nb ...

Go to the complete details ...