News:

Choose a design and let our professionals help you build a successful website   - ITAcumens

Main Menu

Count the Users Accessing the ASP Application

Started by thiruvasagamani, Aug 21, 2008, 11:14 AM

Previous topic - Next topic

thiruvasagamani

The Application object is used,as it is global to all users. Remember to lock and unlock the Application object.

<%

session("account") = Request.Form("account")

%>



The session onstart and onend events are the two events used to add and remove the user from the total user count.

<%
Sub Session_OnStart()

   '**Put your code here **

    Application.Lock

    Application("totalusers") = Application("totalusers") + 1

   Application.Unlock

End Sub

Sub Session_OnEnd()

    '**Put your code here **

    Application.Lock

    Application("totalusers") = Application("totalusers") - 1

   Application.Unlock

End Sub

%>



To print the number of users,just print to the page like so,

<%

Response.Write "The number of users currently using the site are : " &  Application("totalusers")

%>





Thiruvasakamani Karnan