Hi all,
I've been experimenting with the global.asa file lately and have a problem dealing with arrays. I want to see how many sessions are currently open, and at the same time, find there remote ip address. I can get the number of sessions at any one time, but when I loop thru my array (which is actually an application variable), I can only see the latest ip address but the correct num of sessions. The other ip addresses are blank. Can you please take a look at my code? Any suggestions would be helpful.
***********************************************************
global.asa below
************************************************************
<script language="vbscript" runat="server">
sub Application_OnStart
application("USERS"
=0
dim urls(0)
application("URLS"
=urls
end sub
sub session_onstart
session.timeout=1
session("Start"
=now
application.lock
application("USERS"
= application("USERS"
+ 1
size=application("USERS"
redim preserve urls(size-1)
application.unlock
application.lock
urls(size-1)=request.servervariables("REMOTE_ADDR"
application("URLS"
=urls
application.unlock
end sub
sub session_onend
application.lock
application("USERS"
=application("USERS"
- 1
application.unlock
redim urls(size-1)
session("URL"
=request.servervariables("REMOTE_ADDR"
urls(size-1)=session("URL"
application("URLS"
=urls
end sub
</script>
************************************************************
page displaying sessions/ip addresses below
************************************************************
<!-- #include virtual="/global.asa" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<%
response.write ("This many sessions are open: " & application("USERS"
& "<br>"
dim counter
for counter=0 to ubound(application("URLS"
)
response.write counter & ": " & application("URLS"
(counter) & "<br>"
next
%>
</BODY>
</HTML>
************************************************************
Hopefully you can figure out my mess.
Mike
I've been experimenting with the global.asa file lately and have a problem dealing with arrays. I want to see how many sessions are currently open, and at the same time, find there remote ip address. I can get the number of sessions at any one time, but when I loop thru my array (which is actually an application variable), I can only see the latest ip address but the correct num of sessions. The other ip addresses are blank. Can you please take a look at my code? Any suggestions would be helpful.
***********************************************************
global.asa below
************************************************************
<script language="vbscript" runat="server">
sub Application_OnStart
application("USERS"
dim urls(0)
application("URLS"
end sub
sub session_onstart
session.timeout=1
session("Start"
application.lock
application("USERS"
size=application("USERS"
redim preserve urls(size-1)
application.unlock
application.lock
urls(size-1)=request.servervariables("REMOTE_ADDR"
application("URLS"
application.unlock
end sub
sub session_onend
application.lock
application("USERS"
application.unlock
redim urls(size-1)
session("URL"
urls(size-1)=session("URL"
application("URLS"
end sub
</script>
************************************************************
page displaying sessions/ip addresses below
************************************************************
<!-- #include virtual="/global.asa" -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
</HEAD>
<BODY>
<%
response.write ("This many sessions are open: " & application("USERS"
dim counter
for counter=0 to ubound(application("URLS"
response.write counter & ": " & application("URLS"
next
%>
</BODY>
</HTML>
************************************************************
Hopefully you can figure out my mess.
Mike