[This is preliminary documentation and subject to change]

## Increment

The Increment method takes the name of a counter, adds 1 to the current value of the counter, and returns the counter's new value. If the counter doesn't exist, the method creates it and sets its value to 1.

###### Syntax

Counters.Increment(CounterName)

###### Parameters

CounterName
  A string containing the name of the counter.

###### Example

Increment the value of a counter with `<% Counters.Increment(CounterName) %>`. Increment and display the value of a counter with `<%= Counters.Increment(CounterName) %>`.

To retrieve the value of a counter, use Counters.Get. To set a counter to a specific value, use Counters.Set.

The following code implements a one-line page-hit counter.

In this example, Counters.Increment increases the counter by one each time the client requests the page from the server.

--- Counters_Increment.asp ---

    <HTML>
    <HEAD><TITLE>One-line Page-hit Counter</TITLE></HEAD>
    <BODY>
    <!-- The Counters object was instantiated in Global.asa. -->
    <B><%=Request.ServerVariables("URL")%></B> has been viewed <B><%=Counters.Increment("hits")%></B> time(s).
    </BODY>
    </HTML>

###### See Also

Get, Remove, Set

© 1997-2001 Microsoft Corporation. All rights reserved.