Let's say you have a button on your page and you want to know how often it's clicked. Or you just want to know how often users are viewing the pages in your application, but you're not a sysadmin and you don't want to deal with web logs and a log analyzer. Well then, ASP.NET 2.0's site counters are for you. These counters are built into the existing link and button controls, and use a built-in service or your own custom provider (the built-in service works with Sql Server or Access). The counters simply track impressions and/or clicks over whatever timespan you specify (e.g. impressions/hour vs impressions/day -- one row of data will exist per timespan, so more granularity equals a larger database).
The main properties used for individual controls are CountClicks (bool), CounterGroup (string), and CounterName (string). An example hyperlink:
<asp:hyperlink Text=“Click for Partner Details” NavigateUrl=“http://www.partnersite.com”
CountClicks=“true”
CounterGroup=“PartnerClicks”
CounterName=“Partner1”
runat=“server” />
Before these counters will work, the site counters need to be set up using the ASP.NET configuration tool (which unfortunately appears to be broken in the build I'm using at the moment).
You can also specify site-level counters through a section in web.config. The config section is <siteCounters> but the exact syntax seems to be still up in the air at this point. Suffice to say, you will be able to specify individual page paths or wildcard paths of page groups/folders you would like to track activity on.