devxlogo

Count ASP Sessions

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.

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist