The Remove method takes the name of a counter, removes the counter from the Counters object, and deletes the counter from the Counters.txt file.
Counters.Remove(CounterName)
The following code removes the counter hitscounter
from the ounters.txt file.
--- Counters_Remove.asp ---
<HTML>
<HEAD><TITLE>Voting for Colors</TITLE></HEAD>
<BODY>
<%
vote = Request.QueryString("color")
clear = Request.QueryString("clear")
' The Counters object was instantiated in Global.asa.
Counters.Increment(vote & "counter")
If Not ""=clear Then
Counters.Remove("redcounter")
Counters.Remove("greencounter")
Counters.Remove("bluecounter")
End If
%>
<H3>Vote for your Favorite Color:</H3>
<FORM NAME="Voting for Colors" METHOD="GET" ACTION="Counters_Remove.asp">
<input type="RADIO" NAME="color" VALUE="red">Red
<input type="RADIO" NAME="color" VALUE="green">Green
<input type="RADIO" NAME="color" VALUE="blue">Blue
<BR><INPUT TYPE="SUBMIT" VALUE="Submit Vote">
</FORM>
<H3>Current Vote Tally:</H3>
Red: <% =Counters.Get("redcounter") %><BR>
Green: <% = Counters.Get("greencounter") %><BR>
Blue: <% = Counters.Get("bluecounter") %>
<FORM NAME="Clear Counters" METHOD="GET" ACTION="Counters_Remove.asp">
<BR><INPUT TYPE="SUBMIT" VALUE="Clear the Counters" NAME="clear">
</FORM>
</BODY>
</HTML>