Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,


I want to see how many members visited my site. So i have to write code for that in C#. If anybody know this please help me.



Thanks in Advance
Posted

You have a lot of options.

1) You can write something (like a base controller) for your web site that captures page metrics
2) You could write something at the application level, counting sessions
3) You could avoid reinventing the wheel and sign up for Google Analytics and paste an oh-so-small chunk of code on your site's master page or layout (depending on your view engine).

GA is free.

If you have a question about the other two implementations, please feel free to ask questions as you come to more specific scenarios.

Cheers.
 
Share this answer
 
Comments
Jayanthi-SE 10-Nov-11 22:29pm    
Hi,
Could you please give me sample code for that.

Thanks
TheyCallMeMrJames 10-Nov-11 22:34pm    
Which implementation?
Jayanthi-SE 11-Nov-11 21:38pm    
could u plz tell me 2nd implementation
 
Share this answer
 
you can use third party widgets...try the below

www.visitwidget.com/widgets_js.htm[^]

http://24counter.com/[^]
 
Share this answer
 
Use Application variable to store counter.
When user logged in increase counter by one.
Application variable is common for all users.
C#
Application["hitCount"] = convert.ToInt32(Application["hitCount"]) + 1;
 
Share this answer
 
Comments
Jayanthi-SE 21-Nov-11 21:42pm    
Hi,

Could u plz tell me where i have to write this code. I want to display the count number in label.

Thanks
It depend how you want to implement this.

1) If you want to track number of Members/Users logged in into your site then you may track it when Members/Users of your site logging into your site.

2) If you want to track all the public users who browse your site then you may have a look at "Google Analytics" for this.

http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900