i want to get daily,monthly,yearly hits ( visit count ) of my site .
What is t开发者_Go百科he best way to do this in asp.net ?
tnx.
Are you trying to develop a solution in ASP.NET, or would a third-party service work for you?
Google Analytics tracks all of this and more, and is a simple JavaScript include you can throw on your masterpage:
http://www.google.com/analytics/
If you want to roll your own, have a look at the Request
object, it has lots of good stuff like, IP and Referers - you would simply include code to handle this in your Page_Load
.
My personal suggestion would definitely be Google Analytics though!
Internet Information Services logs each requests that it serves. The logs are written to:
C:\WINDOWS\system32\LogFiles
If you run multiple sites, you can retrieve the site number from the web site's properties in IIS. In IIS6, they're in the Logging Properties
dialog.
Once you've located the logs, you can analyze them with LogParser. For example, to retrieve the top 10 most requested pages:
SELECT TOP 10 cs-uri-stem as Url, COUNT(cs-uri-stem) AS Hits
FROM ex*.log
GROUP BY cs-uri-stem
ORDER BY Hits DESC
More examples on the Coding Horror blog.
Analytics is the best but if you want your own, write your own statistics. Just one table in sql. id, ip, referer, date Then write your sql stored procedures and get the statictisc.
精彩评论