4
Reply

How to find total visitors in my website?

sankar

sankar

Dec 1 2011 2:31 AM
1.2k
Hi ,

I want know how to find how many members visit my website and overall members visited my website in asp.net 2.0?

please help me my problem.I am always starting global.aspx coding

public static double count = 1000.0;
    void Application_Start(object sender, EventArgs e)
    {
        // Code that runs on application startup

        Application["OnlineUsers"] = count;
    }
   
    void Application_End(object sender, EventArgs e)
    {
        //  Code that runs on application shutdown

    }
       
    void Application_Error(object sender, EventArgs e)
    {
        // Code that runs when an unhandled error occurs

    }

    void Session_Start(object sender, EventArgs e)
    {
        // Code that runs when a new session is started
        Session["username"] = "";
        Session["etype"] = "";
        Application.Lock();
        count = Convert.ToInt32(Application["OnlineUsers"]);
        Application["OnlineUsers"] = count+ 1;

    }


//Which page i want display  visitors
protected void Page_Load(object sender, EventArgs e)
    {
        Application.Lock();
        if (Application["HitCount"] != null)
        {
            Application["HitCount"] = (int)Application["HitCount"] + 1;
        }
        else
        {
            Application["HitCount"] = 1000;
        }
        Application.UnLock();
       
        visitor.Value = Application["HitCount"].ToString();
       
    }

But this coding using daily visitors only.But i want overall visitors in my website.

Please help me.





Answers (4)