inicio mail me! sindicaci;ón

ASP skill example: Use ASP records the amount of online user

The visit quantity of the network is the problem that each netizens that do a website care very much. The website that how many person is visitting you be informed? How will everyday does visit volume record come down? A solution is below.

When the user begins to visit a website, the Global.asa that the server carries will be visited. Will give user open a Session. Can install oneself individual user information to each user. Here does not undertake explanatoried more. There is the message when Application is started and Session is started to answer function in Global.asa. Can beat the code that be as follows.

It is quotative content below:
  <SCRIPT LANGUAGE= “VBScript” RUNAT= “Server “>

Sub Application_OnStart

   ’When server open, setting user number is 0

Application(”Users” ) = 0

End Sub

Sub Session_OnStart

Session.Timeout = 20

   ’When beginning a Session user number is added 1

Application.Lock

Application(”Users” ) = Application(”Users” ) 1

Application.UnLock

End Sub

Sub Session_OnEnd

   ’When ending a Session user tally is decreased 1

Application.Lock

Application(”Users” ) = Application(”Users” ) - 1

Application.UnLock

End Sub

 </ SCRIPT>

When the website moves, application variable Application(”Users” ) will record the online strength of the website all the time. Can use in any webpage draw up the amount of online user. As to the record, can use a lot of methods. If be a record,arrive in the file, can use Scripting.FileSystemObject thing to undertake handling. If the record arrives in the database, can use ADO to wait a moment. Here did not introduce one by one.

Bookmark:Digg Del.icio.us Reddit

Leave a Comment