149 lines
5.6 KiB
HTML
149 lines
5.6 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
|
|
<TITLE>Page Counter Component</TITLE>
|
|
<SCRIPT LANGUAGE="JavaScript">
|
|
<!--
|
|
TempString = navigator.appVersion
|
|
if (navigator.appName == "Microsoft Internet Explorer"){
|
|
// Check to see if browser is Microsoft
|
|
if (TempString.indexOf ("4.") >= 0){
|
|
// Check to see if it is IE 4
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else {
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
}
|
|
}
|
|
else if (navigator.appName == "Netscape") {
|
|
// Check to see if browser is Netscape
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
|
}
|
|
else
|
|
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
|
//-->
|
|
</script>
|
|
<SCRIPT LANGUAGE="VBScript">
|
|
<!--
|
|
Sub Window_OnLoad()
|
|
Dim frmContents
|
|
On Error Resume Next
|
|
If Not Parent Is Nothing Then
|
|
Set frmContents = Parent.Contents
|
|
If Not frmContents Is Nothing Then
|
|
frmContents.Window.TOCSynch_Click
|
|
End If
|
|
End If
|
|
End Sub
|
|
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
|
|
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
|
|
<META NAME="MS.LOCALE" CONTENT="EN-US">
|
|
<META NAME="MS-IT-LOC" Content="Internet Information Services">
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
|
|
|
<H1><A NAME="_page_counter_component"></A><SUP></SUP>Page Counter Component</H1>
|
|
|
|
<P>The Page Counter component creates a <B>PageCounter</B> object that counts and displays the number of times a Web page has been opened. At regular intervals the object writes the number of hits to a text file so that in the event of a server shutdown, the data is not lost. The Page Counter component uses an internal <B>Central Management </B>object to record how many times each page in the application has been opened. </P>
|
|
|
|
<P>When an instance of the <B>PageCounter</B> object is created on a page by using the <B>Server.CreateObject</B> method, the object retrieves the current hit count for the specified Web page from the <B>Central Management</B> object. The object can then be manipulated with the methods it exposes.</P>
|
|
|
|
<P>The Page Counter component uses the following files:</P>
|
|
|
|
<TABLE border=0 cellpadding=5 cols=2 frame=box rules=all>
|
|
|
|
<TR VALIGN="top">
|
|
<TD class=blue width=43%><B>File Names</B></TD>
|
|
<TD class=blue width=57%><B>Description</B></TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=43%>Pagecnt.dll </TD>
|
|
<TD width=57%>The Page Counter<B> </B>component.</TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=43%><A HREF="/iishelp/iis/htm/asp/comp7aw5.htm">Hit Count Data file</A></TD>
|
|
<TD width=57%>The text file to which the Page Counter<B> </B>component saves the current hit count.</TD>
|
|
</TR>
|
|
</TABLE><BR>
|
|
|
|
<H6>Syntax</H6>
|
|
|
|
<P><B>Set </B><I>oVar </I><B>= Server.CreateObject( "MSWC.PageCounter" )</B> </P>
|
|
|
|
<P> </P>
|
|
|
|
<H6>Parameters</H6>
|
|
|
|
<DL>
|
|
<DT><I>oVar</I></DT>
|
|
|
|
<DD>Specifies the name of the <B>PageCounter</B> object created by the call to <B>Server.CreateObject</B>. </DD>
|
|
</DL>
|
|
|
|
<H6>Registry Entries</H6>
|
|
|
|
<P>The Page Counter adds the key MSWC.PageCounter to the registry when the object is compiled or registered. The key is added under HKEY_CLASSES_ROOT and contains the following named values.</P>
|
|
|
|
<TABLE border=0 cellpadding=5 cols=2 frame=box rules=all>
|
|
|
|
<TR VALIGN="top">
|
|
<TD class=blue width=22%><B>Named Value</B></TD>
|
|
<TD class=blue width=78%><B>Description</B></TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=22%>File_Location </TD>
|
|
<TD width=78%>A string that specifies the path and filename of the Hit Count Data file. The default filename is Hitcnt.cnt. This file is located in your Windows directory.</TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=22%>Save_Count </TD>
|
|
<TD width=78%>A DWORD that specifies the number of hits before the hit count is saved to the Hit Count Data file. Note that this is the total number of hits, not the number of hits per page. The default value is 25. </TD>
|
|
</TR>
|
|
</TABLE><BR>
|
|
|
|
<H6>Methods</H6>
|
|
|
|
<TABLE border=0 cellpadding=5 cols=2 frame=box rules=all>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=40%><A HREF="/iishelp/iis/htm/asp/comp559v.htm">Hits</A></TD>
|
|
<TD width=60%>Displays the number of times that a specified URL has been opened. </TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=40%><A HREF="/iishelp/iis/htm/asp/comp2bhw.htm">PageHit</A></TD>
|
|
<TD width=60%>Increments the Hit Count. </TD>
|
|
</TR>
|
|
|
|
<TR VALIGN="top">
|
|
<TD width=40%><A HREF="/iishelp/iis/htm/asp/comp1lma.htm">Reset</A></TD>
|
|
<TD width=60%>Sets the hit count for a specified page to 0.</TD>
|
|
</TR>
|
|
</TABLE><BR>
|
|
|
|
<H6>Example</H6>
|
|
|
|
<P>The following example uses the <B>PageCounter</B> object to track the number of visitors to the page and sends a special message to the tenth visitor.</P>
|
|
|
|
<P>--- PageCount.asp ---</P>
|
|
|
|
<PRE><CODE><%
|
|
Set MyPageCounter = Server.CreateObject("MSWC.PageCounter")
|
|
HitMe = MyPageCounter.Hits
|
|
If HitMe = 10 Then
|
|
%>
|
|
You are the lucky 10th Customer!!! <BR>
|
|
<% Else %>
|
|
Sorry, you are customer #<%= HitMe %> <BR>
|
|
<% End If %>
|
|
</CODE></PRE>
|
|
<hr class="iis" size="1">
|
|
<p align="center"><em><a href="../../../common/colegal.htm">© 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
|
|
</BODY>
|
|
</HTML>
|