Solved

How to count the no. of hits on the website.

Posted on 2013-02-02
4
310 Views
Last Modified: 2013-02-21
1. How to determine no. of visitors visiting the site.
2. How to determine the ip address of the client machine from where the site was accessed.
3. What is code for implementing Visitors Count logic.
0
Comment
Question by:searchsanjaysharma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 6

Accepted Solution

by:
esolve earned 167 total points
ID: 38846871
You can use this on your website to determine the visitors IP address:

HttpContext.Current.Request.UserHostAddress;
or
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];

For the visitorCount you can use the Application_BeginRequest event in global.asax. See this link. or you can use a free jscript visitor counter

http://stackoverflow.com/questions/7568497/asp-net-visitors-counter

Some more examples here:
http://www.codeproject.com/Articles/5912/Easy-to-use-Hit-Counter
http://www.codingasp.net/2011/09/unique-visiter-counter-in-aspnet.html
http://archive.devnewz.com/2004/0127.html
0
 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 166 total points
ID: 38847015
The best choice is to use AWStats or a similar program that gets all that info from your server logs.  http://awstats.sourceforge.net/  It is open source and you can get the code for it.
0
 
LVL 10

Assisted Solution

by:Monica P
Monica P earned 167 total points
ID: 38850306
Visitors Count

http://www.aspdotnetfaq.com/Faq/How-to-show-number-of-online-users-visitors-for-ASP-NET-website.aspx

http://r4r.co.in/asp.net/01/tutorial/asp.net/Count%20Number%20of%20Visitors%20in%20WebSite%20using%20ASP.Net%20and%20C-sharp.shtml

http://ravuripradeep.blogspot.com/2010/04/how-to-show-number-of-online-users.html

http://stackoverflow.com/questions/2719903/how-can-i-find-number-of-visitors-users-at-my-site-iis7-asp-net-at-any-given-m

To get client IP

HttpContext.Current.Request.UserHostAddress;
or
HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
 
To get the IP address of the machine and not the proxy use the following code
 
HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

Open in new window

0
 

Author Closing Comment

by:searchsanjaysharma
ID: 38914018
tx
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question