online user count

  • Thread starter Thread starter Tahir
  • Start date Start date
T

Tahir

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
 
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.
 
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.
 
Back
Top