My question has to do with grabbing all the active users on my site. Below are the specs:
- IIS Version: IIS 8.5
- Server: Windows Server 2012 R2
- Root folder: D:\Sites\Default\WWWRoot
- Site Directory: D:\Sites\Default\WWWRoot\Website
Website is the directory where all the pages are stored. This is also the page that is listed as the Default App Pool in IIS. Classic ASP is the default language we are using.
Recently, my manager asked that we grab the active users currently hitting our site on the index of the page and display it.
So I made a file called Global.asa in the WWWRoot Folder (not the Website directory) and this is the contents of the asa file:
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart
application("activevisitors")=0
End Sub
Sub Application_OnEnd
End Sub
Sub Session_OnStart
application.lock
application("activevisitors")=application("activevisitors")+1
application.unlock
End Sub
Sub Session_OnEnd
application.lock
application("activevisitors")=application("activevisitors")-1
application.unlock
End Sub
</SCRIPT>
And in the Websites directory where all the site pages are stored, I have an index.asp file that has the below added:
There are <% response.write(application("activevisitors")) %> active visitors
When I load index.asp, it gives me "There are active visitors." but no numbers or count like its supposed to do. Here are my questions
- Should Global.asa be in the WWWRoot folder (currently located) or the Websites folder (where index.asp located)
- Does IIS need to be configured to allow .asa files? I noticed in Request Filtering the .asa is False for allowed.
- Is the code correct? I even made a dummy asp page to see if just displaying the counter will work but it doesn't either.
- Confirmed ASP pages
- Does the ASA code look correct?
I have looked via google search and around here, nothing could give me the help that I need. I am hoping someone here could provide some direction. Greatly appreciate it.