Count ASP Sessions

Question:
I am trying to count the number of users (sessions opened) to a given app. It easy enough to increment an Application variable with Session_Onstart and decrement it with Session_OnEnd. My problem is that I want to get a count for users that are external to my company (basically filtering out certain IP addresses). By using the Request.ServerVariables(“REMOTE_ADDR”), I am able to filter out the IP address and increment it correctly without any problems. However, when I try the same for the Session_onEnd, it does not decrement.

Answer:
In the Session_OnStart, if the surfer passes your filter criteria, set the value of a Session variable to true. Then, in the Session_OnEnd, check for your Session variable value. If true, decrement your Application variable value.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: