?
Solved

Global.asa not firing...

Posted on 2005-03-29
8
Medium Priority
?
381 Views
Last Modified: 2012-06-27
I am currently working on a web app that uses global.asa to set Application-wide variables (using Session_OnStart).  When I was working from a Windows 2000 Server development server, methods in Global.asa worked correctly.  Now I am off-site, I have transferred to a Windows 2000 Pro machine and am using IIS/localhost to develop the app and the Global.asa events do not fire.

The Windows 2000 Server development environment was set up using Interdev but the Windows 2000 Pro environment has been done manually via Internet Services Manager.  Both environments have Read, Execute and Write (where I need it)

Is there something I have missed in my setup, or does Pro not support Global.asa?

J.
0
Comment
Question by:jimbobmcgee
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 13

Expert Comment

by:nurbek
ID: 13651398
make sure that global.asa is on a root folder

or create a virtual directory "mywebsite" (path c:\websites\myweb)
and put the global.asa into c:\websites\myweb

run your asp file from http://localhost/myweb

also to check your globals asa
put
Response.Write "global.asa works"
into session on start event
0
 
LVL 13

Expert Comment

by:nurbek
ID: 13651404
should be
run your asp file from http://localhost/mywebsite 
0
 
LVL 16

Author Comment

by:jimbobmcgee
ID: 13651556
I have my app working from a VD -- http://localhost/jimbobmcgee -- and global.asa is indeed in this folder.  It should write to a log file (for debug purposes) in Session_OnStart but the log is not created.  More importantly, my Application variables are not set.

I tried putting

    Response.Write("Global.asa is firing...")
    Response.End

at the top of the Session_OnStart routine but it did not return this.

J.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 13

Accepted Solution

by:
nurbek earned 2000 total points
ID: 13651614
try the below code

test.asp
---------------------
<%
Response.Write("<br>Online Users: " & Application("visitors"))
%>

global.asa
---------------
<script language="vbscript" runat="server">
Sub Application_OnStart
Application("visitors")=0
End Sub

Sub Session_OnStart
Response.Write("Session is fired")
Application.Lock
Application("visitors")=Application("visitors")+1
Application.UnLock
End Sub

Sub Session_OnEnd
Application.Lock
Application("visitors")=Application("visitors")-1
Application.UnLock
End Sub

</script>
0
 
LVL 16

Author Comment

by:jimbobmcgee
ID: 13651849
Just got:

    --------------------------------------------------------

    Online Users:

    --------------------------------------------------------

every time...

J.
0
 
LVL 13

Expert Comment

by:nurbek
ID: 13651869
make sure that session is enabled

to check it
-----test.asp ---
<%
Session("test")="test value"

Response.Write(Session("test"))

%>
0
 
LVL 16

Author Comment

by:jimbobmcgee
ID: 13652044
OK, the above did not work because the IUSR account did not have rwx permissions to the folder.  I have now given this account access to the parent folder and the test app nurbek worked fine.  However, my app is still telling me that the Application variable I need to poll is empty.

So, to recap, I now have 'Read' and 'Script Source Access' set for the VD in IIS and 'Read', 'Read & Execute' and 'List Folder Contents' set on the actual folder, for the IUSR account...

Still the Session_OnStart routine is not fired...

J.
0
 
LVL 16

Author Comment

by:jimbobmcgee
ID: 13652194
OK, so in my test app, I now have:

      <%
            Response.Write("<P> Online Users: " & Application("visitors") & "</P>")

            Session("test") = "hello session"
            Application("test") = "hello application"

            Response.Write(Session("test") & "<BR />")
            Response.Write(Application("test") & "<BR />")
      %>

And I get the response:

      Session is fired
      Online Users: 2

      hello session
      hello application

So I rebuilt my app's VD and it works.  Beats me why it didn't before but, never mind, I'm sorted now.

I'm awarding the points to nurbek for the test code -- at least it enabled me to see that global.asa _should_ be firing, even in Windows 2000 Pro.

Thanks for your time.

J.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question