Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
friends i want to get total no. of unique visits .
one logic is that ---
fetch the ip address and check from data base if its not available then increment the counter
otherwise not.
But it would take much time and make the site slow.Is it feasible?
 

 
is there any other method to do this.
pls suggest me
 
thanx in advance...
Posted 15-Feb-13 2:14am
maan_k446
Comments
Zoltán Zörgő at 15-Feb-13 7:16am
   
Are you in an intranet? Are the IP addresses fixed?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Reading the IP is very quick: Request.UserHostAddress will give it too you immediately. The SQL check should not be long in human terms either - it's just a simple query:
SELECT COUNT(*) FROM IPTable WHERE IPAddress='100.100.100.100'
and can be executed as a ExecuteScalar to return just the value. 0 means it's not in there.
 
So why should it be slow?
However, you should be aware that all users on teh same internet connection will have the same IP address - so all users from the same company will probably match.
  Permalink  
Comments
Marcus Kramer at 15-Feb-13 11:02am
   
+5.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi ,
 
you need to do a bit with global.asx,please go with the below link :
 

http://www.sujitbhujbal.com/2012/12/how-to-count-website-visitors-in-aspnet.html[^]
 

hope it ll solve your issue.
 
Thanks
Neha Sharma
nehaprogrammer.blogspot.in
  Permalink  
Comments
maan_k at 15-Feb-13 7:39am
   
thanx.,but i need the total no. of unique visits.I visited above link, here the code written is for total no. of visits.it will increment the counter in both cases whether the user is visited earlier or not.
nehas1jan at 15-Feb-13 7:45am
   
Hi,
 
Then go with these links ll defenatly solve the issues :
 
http://stackoverflow.com/questions/764976/asp-net-tracking-code-unique-visitors
 
http://www.codeguru.com/csharp/.net/net_asp/article.php/c19443/Tracking-Visitors-with-ASPNET.htm
 
All the Best!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web03 | 2.8.150301.1 | Last Updated 15 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100