Migrating a Web Server to IIS 5.0 |
To improve the performance and efficiency of your Web site, you can replace CGI-based page counters with the ASP Page Counter Component included with IIS 5.0. This creates a PageCounter object that counts and displays the number of times a Web page has been opened. It also writes the number of page hits to a text file. The following ASP script, written in PerlScript, demonstrates how to query the component and display the hit count:
<%@ LANGUAGE=PerlScript %>
<HTML>
<BODY>
<%
$counter = $Server->CreateObject("MSWC.PageCounter");
$hits = $counter->Hits;
%>
You are visitor number <%= $hits %> to this page.
</BODY>
</HTML>
For more information about ASP components, see the “Module 2: Using COM Components” topic in the ASP Tutorial, found in the IIS 5.0 online product documentation.