Sideway
output.to from Sideway
Draft for Information Only

Content

ASP Server Components
  Counters component
    File Name
    Syntax
    Parameters
    Remark
   Counters.Get Method
    Syntax Syntax
    Parameters
   Counters.Increment Method
    Syntax
    Parameters
   Counters.Remove Method
    Syntax
    Parameters
   Counters.Set Method
    Syntax
    Parameters
   Examples

ASP Server Components

Some of the ASP server components are the common features found in dynamic web pages. These base ASP server components are provided to enrich the pre-made functions of ASP technology for making dynamic and interactive web pages. However, some IIS pre-made components are not installed for all version of IIS. Ad Rotator, Browser Capabilities, Content Linker, Content Rotator, Counters, Logging Utility, My Info, Page Counter, Status, and tools are not installed with IIS 6.0. However, if you upgrade your Web server from a previous version of IIS, the pre-made components are not removed. Some IIS pre-made components, ASP content rotator and nextlink,  are deprecated in IIS7. And most IIS pre-made components are either not installed with IIS7 or their usage is not supported.

Counters component

The Counters component can be used to create a Counters object that acts as a HTML tags holder on an ASP page for controlling any number of individual counters on a web page. The function of the Counters object is to create, store, increase, and retrieve any number of individual counters on the web page each time when an user opens or reloads the web page. Each counter is a persistent value that contains an integer. Once a counter is created by the set method, the counter persists until the counter is removed by the remove methods. Each counter does not increase automatically on an event like a page hit. The value of a counter can only be manually set or increased using the set and increment methods.

Only one instance of Counters object is needed for a web site. Therefore the Counters object can be defined in the global.asa at the root directory of web application. And individual created counters are not limited in scope. An individual counter created on any page of the web site can also be retrieved or manipulated by any other page on the web site using methods of the Counters Component. All individual conuters created by the Counters Object are stored in a single text file, e.g. Counters.txt, which is located in the same directory as the counters.dll file.  For example, an individual counter can be increased and displayed on more than one page on the web site. In other words, whenever there is an increment of the individual counter due to one page on the web site, the changes on the individual counter can be displayed on the related pages simultaneously when the page is opened or reloaded.

The change in a Counters.txt File may need to restart the IIS services in ordered to make the changes by the Counters Object become effective. The Counters.txt File may be located in %WINDIR%\inetsrv\Data or %WINDIR%\inetsrv\ directory depending on the verson of IIS and the operating system.

File Name

The file name of the Content Rotator component is Controt.dll.

A file, Counters.txt is used to store all individual counters on a site. Counters.txt is a UTF8-encoded file. And therefore any Unicode characters can be used in a counter name.

Syntax

The Counters object is defined by a HTML <object> tag. Only one Counters object is needed for a site. A single Counters object can create any number of individual counters. Therefore the Counters object can be created only one time on the server by adding the <object> tag to the Global.asa in the root directory.

<OBJECT
RUNAT=Server
SCOPE=Application
ID=CountersName
PROGID="MSWC.Counters">
</OBJECT>

Parameters

CountersName

The parameter "CountersName" is the name assigned to the instance of the Counters object created by the HTML <object> tag.

Remark

The Content Rotator component does not work with Internet Information Server 7 (IIS7).

Counters.Get Method

Counters.Get method is used to retrieve the current value of the specified individual counter. If the specified individual counter doesnot exist, the Counters.Get method creates the specified individual counter and sets the value of the specified individual counter to 0.

Syntax Syntax

CountersName.Get( CounterName )

Parameters

CountersName

The parameter "CountersName" is the name of the instance of the Counters object to be set.

CounterName

The parameter "CounterName" is used to specified the name of the individual counter to be retrieved.

Counters.Increment Method

Counters.Increment method is used to add 1 to the current value of the specified individual counter and then retrieve the new value of the specified individual counter. If the specified individual counter doesnot exist, the Counters.Get method creates the specified individual counter and sets the value of the specified counter to 1.

Syntax

CountersName.Increment( CounterName )

Parameters

CountersName

The parameter "CountersName" is the name of the instance of the Counters object to be set.

CounterName

The parameter "CounterName" is used to specified the name of the individual counter to be retrieved.

Counters.Remove Method

Counters.Remove method is used to remove the specified individual counter from the Counters object, and deletes the specified individual counter from the Counters.txt file.

Syntax

CountersName.Remove( CounterName )

Parameters

CountersName

The parameter "CountersName" is the name of the instance of the Counters object to be set.

CounterName

The parameter "CounterName" is used to specified the name of the individual counter to be retrieved.

Counters.Set Method

Counters.Set method is used to set the value of the specified individual counter according to the value of the specified integer and then retrieve the new value of the specified individual counter. If the specified individual counter doesnot exist, the Counters.Set method creates the specified individual counter and sets the value of the specified individual counter to the value of the specified integer.

Syntax

CountersName.Set( CounterName,int )

Parameters

CountersName

The parameter "CountersName" is the name of the instance of the Counters object to be set.

CounterName

The parameter "CounterName" is used to specified the name of the individual counter to be retrieved.

int

The parameter "int" is used to specified the new integer value of the specified individual counter in Parameter, CounterName,  to be retrieved..

Examples

  • Example of making use of Counters component to create an instance of Counters object with ID equal to "Counters" by a HTML <object> tag in the Global.asa in the root directory of the web site for all ASP pages below.

    Global.asa:

    <OBJECT
    RUNAT=Server
    SCOPE=Application
    ID=Counters
    PROGID="MSWC.Counters">
    </OBJECT>

  • Example of making use of Counters.Set method to create an individual counter with name called "SiteCounterA" and assign a specified integer value, 10 to the counter. And then the value of the individual counter, SiteCounterA is retrieved and displayed on the web page.

    ASP Page:

    Setting the SiteCounterA to <%= Counters.Set("SiteCounterA", 10)%>.

  • Example of making use of Counters.Increment method to increase an individual counter with name called "SiteCounterA" by one and then the value of the individual counter, SiteCounterA is retrieved and displayed on the web page.

    ASP Page:

    The SiteCounterA is increased by 1 to
        <%=  Counters.Increment("SiteCounterA")%>.

  • Example of making use of Counters.Set method to set the individual counter with name "SiteCounterA" to the specified integer value, 20. And then making use of Counters.Get method to is retrieve and display the value of the individual counter, SiteCounterA on the web page.

    ASP Page:

    <% Counters.Set "SiteCounterA", 20 %>
    The SiteCounterA is set to <%= Counters.Get("SiteCounterA")%>.

  • Example of making use of Counters.Remove method to remove the individual counter, SiteCounterA from the Counters object, and deletes the individual counter, SiteCounterA  from the Counters.txt file. And then making use of Counters.Get method to is retrieve and display the value of the  individual counter, SiteCounterA on the web page.

    ASP Page:

    <% Counters.Remove("SiteCounterA") %>
    The SiteCounterA becomes <%= Counters.Get("SiteCounterA")%> because the  SiteCounterA is removed and doesnot exist .


©sideway

ID: 130200008 Last Updated: 2/16/2013 Revision: 0 Ref:

close

References

  1. Active Server Pages,  , http://msdn.microsoft.com/en-us/library/aa286483.aspx
  2. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929%28v=vs.90%29.aspx
  3. ASP Best Practices,  , http://technet.microsoft.com/en-us/library/cc939157.aspx
  4. ASP Built-in Objects,  , http://msdn.microsoft.com/en-us/library/ie/ms524716(v=vs.90).aspx
  5. Response Object,  , http://msdn.microsoft.com/en-us/library/ms525405(v=vs.90).aspx
  6. Request Object,  , http://msdn.microsoft.com/en-us/library/ms524948(v=vs.90).aspx
  7. Server Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525541(v=vs.90).aspx
  8. Application Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525360(v=vs.90).aspx
  9. Session Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms524319(8v=vs.90).aspx
  10. ASPError Object,  , http://msdn.microsoft.com/en-us/library/ms524942(v=vs.90).aspx
  11. ObjectContext Object (IIS),  , http://msdn.microsoft.com/en-us/library/ms525667(v=vs.90).aspx
  12. Debugging Global.asa Files,  , http://msdn.microsoft.com/en-us/library/aa291249(v=vs.71).aspx
  13. How to: Debug Global.asa files,  , http://msdn.microsoft.com/en-us/library/ms241868(v=vs.80).aspx
  14. Calling COM Components from ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524620(v=VS.90).aspx
  15. IIS ASP Scripting Reference,  , http://msdn.microsoft.com/en-us/library/ms524664(v=vs.90).aspx
  16. ASP Keywords,  , http://msdn.microsoft.com/en-us/library/ms524672(v=vs.90).aspx
  17. Creating Simple ASP Pages,  , http://msdn.microsoft.com/en-us/library/ms524741(v=vs.90).aspx
  18. Including Files in ASP Applications,  , http://msdn.microsoft.com/en-us/library/ms524876(v=vs.90).aspx
  19. ASP Overview,  , http://msdn.microsoft.com/en-us/library/ms524929(v=vs.90).aspx
  20. FileSystemObject Object,  , http://msdn.microsoft.com/en-us/library/z9ty6h50(v=vs.84).aspx
  21. http://msdn.microsoft.com/en-us/library/windows/desktop/ms675944(v=vs.85).aspx,  , ADO Object Model
  22. ADO Fundamentals,  , http://msdn.microsoft.com/en-us/library/windows/desktop/ms680928(v=vs.85).aspx
close

Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 224

Software

Application 213

Digitization 32

Latex 52

Manim 204

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 33

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2022 Sideway . All rights reserved Disclaimers last modified on 06 September 2019