The access volume of the network is a matter of great concern to all netizens who work on the website. How many people are visiting your website? How to record the daily traffic volume? The following is a solution.
When a user starts to access the website, the Global. asa on the server side will be accessed. A Session is enabled for the user. You can set personal user information for each user. I will not explain it here. In Global. asa, message response functions are provided when Application and Session are started. You can enter the following code.
<Script language = "VBScript" RUNAT = "Server">
Sub Application_OnStart
'When the server is enabled, set the number of users to 0.
Application ("Users") = 0
End Sub
Sub Session_OnStart
Session. Timeout = 20
'The number of users increases by 1 when a Session starts
Application. Lock
Application ("Users") = Application ("Users") + 1
Application. UnLock
End Sub
Sub Session_OnEnd
'When a Session ends, the user counter minus 1
Application. Lock
Application ("Users") = Application ("Users")-1
Application. UnLock
End Sub
</SCRIPT>
When the website is running, the Application Variable Application ("Users") keeps recording the number of online Users of the website. You can use the number of online users on any web page. As for the record, you can use many methods. If it is recorded in a file, you can use the Scripting. FileSystemObject object for processing. If it is recorded in the database, you can use ADO and so on. Here we will not introduce them one by one.