Figure 2   CHitTracker


 ' CHitTracker component
 Implements ObjectControl
 Private SessionInfo As String
 
 Public Function GetSessionInfo() As String
  GetSessionInfo = SessionInfo
 End Function
 
 Private Sub ObjectControl_Activate()
   Dim req As Request, ses As Session
   Set req = GetObjectContext("Request")
   Set ses = GetObjectContext("Session")
   If (ses("Initialized") <> True) Then
     ' first time through
     ses("Initialized") = True
     SessionInfo = "Session started at " & Now & "<br>" & _
                   "Client address : " & _
                   req.ServerVariables("REMOTE_ADDR") & "<br>"
   Else
     ' everything except first time
     SessionInfo = ses("Info")
     SessionInfo = SessionInfo & "Hit at " & Now & "<br>"
   End If
   ' write new value out to session variable
   ses("Info") = SessionInfo
 End Sub
 
 Private Sub ObjectControl_Deactivate()
 ' watch out! - Deactivate will not properly write to 
 ' session variables when your objects deactivate
 End Sub
 
 Private Function ObjectControl_CanBePooled() As Boolean
   ' object pooling is not currently supported - return False
   ObjectControl_CanBePooled = False
 End Function