online user count

Discussion in 'ASP .Net' started by Tahir, Dec 29, 2008.

  1. Tahir

    Tahir Guest

    Hi,
    i have a problem with my online user count;

    void Session_Start(object sender, EventArgs e)
    {...
    System.Web.HttpBrowserCapabilities tarayici = Request.Browser;
    if (tarayici.Crawler)
    return;
    Application.Lock();
    Application["ActiveUsers"] =
    Convert.ToInt32(Application["ActiveUsers"]) + 1;
    Application.UnLock();
    ....}

    the Application["ActiveUsers"] shows the hit about 100.
    then i log the request ip and some other information like date to my sql.
    so it is clear that all the hit is made bu Google, Yahoo and some other
    search engines.

    what can i do to count only the human visiters but not the bots?

    thanks
     
    Tahir, Dec 29, 2008
    #1
    1. Advertising

  2. Tahir

    George Guest

    Probably the best way to count Browsers and not crawlers is to embed a
    transparent image into your pages.
    And count hit as a user only if this image is beign hit by browser.

    So somehting like this.

    ------Anypage.aspx--------
    if( Sesssion["count"] == null )
    Sesssion["count"] = 1;
    ......
    <img src="/userCounter.aspx">

    ------userCounter.aspx--------

    if ((Session["count"] != null) && (Session["count"] == 1))
    {
    Application["ActiveUsers"] =
    Convert.ToInt32(Application["ActiveUsers"]) + 1;
    Session["count"] = 2;
    }


    So the idea is to first make sure that user requested the aspx page and then
    requested an image. Thus eliminating BOTs that hit pages as well as bots
    that hit images.


    George.


    "Tahir" <> wrote in message
    news:...
    > Hi,
    > i have a problem with my online user count;
    >
    > void Session_Start(object sender, EventArgs e)
    > {...
    > System.Web.HttpBrowserCapabilities tarayici = Request.Browser;
    > if (tarayici.Crawler)
    > return;
    > Application.Lock();
    > Application["ActiveUsers"] =
    > Convert.ToInt32(Application["ActiveUsers"]) + 1;
    > Application.UnLock();
    > ...}
    >
    > the Application["ActiveUsers"] shows the hit about 100.
    > then i log the request ip and some other information like date to my sql.
    > so it is clear that all the hit is made bu Google, Yahoo and some other
    > search engines.
    >
    > what can i do to count only the human visiters but not the bots?
    >
    > thanks
    >
     
    George, Dec 29, 2008
    #2
    1. Advertising

  3. Tahir

    Larry Bud Guest

    On Dec 29, 8:36 am, "Tahir" <> wrote:
    > Hi,
    > i have a problem with my online user count;
    >
    > void Session_Start(object sender, EventArgs e)
    > {...
    >         System.Web.HttpBrowserCapabilities tarayici = Request.Browser;
    >         if (tarayici.Crawler)
    >             return;
    >         Application.Lock();
    >         Application["ActiveUsers"] =
    > Convert.ToInt32(Application["ActiveUsers"]) + 1;
    >         Application.UnLock();
    > ...}
    >
    > the Application["ActiveUsers"] shows the hit about 100.
    > then i log the request ip and some other information like date to my sql.
    > so it is clear that all the hit is made bu Google, Yahoo and some other
    > search engines.
    >
    > what can i do to count only the human visiters but not the bots?



    Require a login to access your site.
     
    Larry Bud, Dec 29, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tranky

    Count number of online users...

    tranky, Jul 24, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    498
    John Timney \(MVP\)
    Jul 24, 2006
  2. nani
    Replies:
    0
    Views:
    439
  3. chinni
    Replies:
    0
    Views:
    434
    chinni
    Nov 20, 2009
  4. chinni
    Replies:
    0
    Views:
    476
    chinni
    Nov 20, 2009
  5. efelnavarro09
    Replies:
    2
    Views:
    980
    efelnavarro09
    Jan 26, 2011
Loading...

Share This Page