Online | My Global.asa file is as follows:
<script language= "VBScript" runat= "Server" >
' Session_OnStart run when a customer first runs any page in an ASP application
' Session_OnEnd run when a client's session times out or quits the application
' Application_OnStart run when any customer first accesses the first page of the application
' Application_OnEnd run when the Web server for the site is down
Sub Application_OnStart
Visitorcountfilename = Server.MapPath (".. /visitcount.txt ")
Set FileObject = Server.CreateObject ("Scripting.FileSystemObject")
Set out= Fileobject.opentextfile (Visitorcountfilename, 1, false, False)
Application ("visitors") = Out.readline
Application ("Nowpeoplenumber") =0
Application ("visitorcountfilename") = Visitorcountfilename
End Sub
'=========================================================
SUB Application_OnEnd
Set fileoutobject = Server.CreateObject ("Scripting.FileSystemObject")
Set out= fileoutobject.createtextfile (Application ("Visitorcountfilename"), True,false)
Out.writeline (Application ("visitors"))
End Sub
'=========================================================
Sub Session_OnStart
Session.Timeout = 30
Application ("visitors") = Application ("visitors") + 1
Application ("Nowpeoplenumber") =application ("Nowpeoplenumber") +1
Session ("ID") =session.sessionid
Session ("UserName") =0 ' does not exist
End Sub
'=========================================================
Sub Session_OnEnd
Application ("Nowpeoplenumber") =application ("Nowpeoplenumber")-1
End Sub
</SCRIPT>
In this case, the total number of visitors will be saved in the VisitCount.txt file, I think application ("Nowpeoplenumber") should be saved
Number online, show it on the home page, but doing so I found when I closed the browser when I opened the homepage
The number of online people increased by 1. That is to say Session_OnEnd is not executed. What's the reason? There are other ways to get it.
Number of people online? Thank you for your first post.