 |
| Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 26th, 2007, 07:22 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Global.asa
Hi All,
I want to find out how many users (in our Active directory )are accessing my web portal.
so i put Global.asa file to find out the active users. But which is not working .It doesnot give any no. of users.
Following .asa code is not working for my portal
<SCRIPT LANGUAGE="VBScript" RUNAT="Server">
Sub Application_OnStart
' Set our user count to 0 when we start the server
Application("ActiveUsers") = 0
End Sub
Sub Session_OnStart
' Change Session Timeout to 20 minutes (if you need to)
Session.Timeout = 20
' Set a Session Start Time
' This is only important to assure we start a session
Session("Start") = Now
' Increase the active visitors count when we start the session
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") + 1
Application.UnLock
End Sub
Sub Session_OnEnd
' Decrease the active visitors count when the session ends.
Application.Lock
Application("ActiveUsers") = Application("ActiveUsers") - 1
Application.UnLock
End Sub
</SCRIPT>
and in one simple page of portal i have called the object of this file as
<%=Application("ActiveUsers")%>
but does not give any output.
|
|

February 26th, 2007, 05:36 PM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
is the directory holding your global.asa set as an application root?
|
|

February 27th, 2007, 03:50 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
yes this file is resides on the application's root.
after Exicution of the one sample web page where the
output display as,
<%=Apllication("ActiveUsers")%>
which dosenot give any output as well as any error also.
Just blank is displayed.
now what can i do.
any solution?
|
|

February 27th, 2007, 06:25 PM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
try adding this code to the bottom of your page to see if your establishing a session id at least.
Code:
<%
'see my session variables for debugging
dim i
dim j
j=Session.Contents.Count
Response.Write("Session variables: " & j)
For i=1 to j
Response.Write(Session.Contents(i) & "<br />")
Next
Response.Write(Session.SessionID)
%>
|
|

February 28th, 2007, 09:11 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
hi, im too trying to write a global.asa file so that i can authenticate users. i have in session_OnStart:
Session("Authenticated") = 0
that is all i was told i needed and then in the asp page i set the authenticated to 1 when they are logged in
what code should i use (if any) to reset the session ( or is that done in the OnStart?) and how can i create a time out?
I also wish to create a logout button which will reset the authentication and the session but again i am unsure how, can someone direct me to a good site to read up about it?
Thanks
|
|

February 28th, 2007, 09:17 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
here I put he code provided by you,
so the o/p is as follows.
value of j(where j is Session.Contents.Count)
So, j=Session.Variables=0
as well as, Session.Contents(1)=092880979 (only single figuer)
and Session.SessionID= is blank.
nothing else.
|
|

February 28th, 2007, 09:25 AM
|
|
Friend of Wrox
|
|
Join Date: Feb 2007
Posts: 115
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
sorry was that for me or the other poster?
|
|

February 28th, 2007, 09:33 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
topic reply is for other poster
|
|

February 28th, 2007, 10:12 AM
|
|
Authorized User
|
|
Join Date: Jan 2007
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Session.Variables=1
Session.Contents='displays current Date and time'
Session.SessionID=092880979
what next i do.
still no active users displayed.
|
|

February 28th, 2007, 01:15 PM
|
|
Authorized User
|
|
Join Date: Feb 2007
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
is your global.asa at your web root? if not try copying it there and see if there's a change
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| global.asa |
vin_0x1 |
Classic ASP Components |
2 |
July 24th, 2006 01:13 AM |
| Global.asa |
gmoney060 |
Classic ASP Basics |
3 |
September 25th, 2004 09:11 AM |
| GLOBAL.ASA |
zaeem |
Classic ASP Databases |
3 |
November 4th, 2003 09:13 AM |
| Global.asa |
madsmad |
ASP.NET 1.0 and 1.1 Basics |
1 |
August 17th, 2003 07:05 PM |
|
 |