HOW TO: Use the ASP PageCounter Component in FrontPage 2000

Article translations Article translations
Article ID: 309008 - View products that this article applies to.
This article was previously published under Q309008
This article has been archived. It is offered "as is" and will no longer be updated.
Expand all | Collapse all

On This Page

SUMMARY

Use this step-by-step guide to set up a Web page with a Page Counter installable component for Active Server Pages (ASP).

The Page Counter component creates a PageCounter 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.




Creating a Page and Adding the Page Counter Component Code

  1. On a Web server running Internet Information Services (IIS), start FrontPage and then open a Web.
  2. Start a new page. To do this, click the New Page button on the FrontPage toolbar.
  3. Switch to HTML view.
  4. Insert the following code before the opening <body> tag to create an object for the counter, to increment the hit count, and to store the hit count in a variable:
    <%
        Dim lngHits
        Dim objCounter
    
        Set objCounter = Server.CreateObject("MSWC.PageCounter")
        objCounter.PageHit
        lngHits = objCounter.Hits
        Set objCounter = Nothing
    %>
    					
  5. Switch back to Normal view.



Using the Hit Counter on the Page

  1. Type You are visitor followed by a space.
  2. Insert an HTML Markup Web component and add the ASP code that will use the hit counter object. To do this, perform the following steps:
    1. On the Insert menu, click Advanced.
    2. Select the HTML control.
  3. In the HTML Markup dialog box, type the following code:
    <%=lngHits%>
    						
    This code retrieves the current hit count that is stored in the variable created in the code example in Step 1.
  4. Click OK to close the HTML Markup dialog box.



Saving and Previewing the Page

  1. On the File menu, click Save.
  2. Name the file CounterText.asp and click Save.
  3. On the File menu, click Preview in Browser.
  4. Click Preview.
If you refresh the page in your browser, you will see the count value increment.

NOTE: Because the output from the counter object is text, changing the fonts or colors for the page also changes the counter.

For more information about changing the fonts or colors, click Microsoft FrontPage Help on the Help menu, type fonts or colors in the Office Assistant or the Answer Wizard, and then click Search to view the topic.



Active Server Pages (ASP) for IIS come with several built-in objects, such as the Response and Request objects. In addition to these objects, IIS has several "Installable Components" that you can use with ASP. The Page Counter Component allows you to create text-based counters for use on Web pages.




REFERENCES

For additional information about installable components for ASP, view the IIS documentation at the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/library/aa480184.aspx






Properties

Article ID: 309008 - Last Review: October 24, 2013 - Revision: 1.1
APPLIES TO
  • Microsoft FrontPage 2000 Standard Edition
Keywords: 
kbnosurvey kbarchive kbhowto kbhowtomaster KB309008

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com