Skip to content

One new code

Prashant More

Asked Apr 23, 2008, 10:39 PM EDT1 answer
Share
LinkedInX

Hello friends,

I want to know the code for how many hits my site currently get.OR How many visitors visits our site.

If anyone found this code please mail me to

[email protected]

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Bechir Bejaoui
    0
    add a global asax file into your application then
    create a new integer
    in the void   Session_Start(Object sender, EventArgs e) even handler add this code
    Application("Count",0);
    in the void   Session_Start(Object sender, EventArgs e) handler add this code
    int UserCount = Convert.ToInt32(Application.Get("Count").ToString());
    UserCount +=1;
    Application.Set("Count",UserCount);
    in the in the void   Session_End(Object sender, EventArgs e) handler add this code
    int UserCount = Convert.ToInt32(Application.Get("Count").ToString());
    UserCount -=1;
    Application.Set("Count",UserCount);

    then go to your page and add a Label and name it lblCount

    use this code to get the application visitor in the lblCount
    lblCount.Text = Application.Get("UserCount").ToString();


    Hope that help you
    0