Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > online user count

Reply
Thread Tools

online user count

 
 
Tahir
Guest
Posts: n/a
 
      12-29-2008
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

 
Reply With Quote
 
 
 
 
George
Guest
Posts: n/a
 
      12-29-2008
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>


 
Reply With Quote
 
 
 
 
Larry Bud
Guest
Posts: n/a
 
      12-29-2008
On Dec 29, 8:36*am, "Tahir" <(E-Mail Removed)> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Count(*) in a Subquery with multiple tables: How does SQL determine which table to generate the Count() from? Kaimuri MCSD 3 12-29-2004 06:38 PM



Advertisments