Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 396
  • Last Modified:

Global.asa not firing...

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
jimbobmcgee
Asked:
jimbobmcgee
  • 4
  • 4
1 Solution
 
nurbekCommented:
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
 
nurbekCommented:
should be
run your asp file from http://localhost/mywebsite 
0
 
jimbobmcgeeAuthor Commented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
nurbekCommented:
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
 
jimbobmcgeeAuthor Commented:
Just got:

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

    Online Users:

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

every time...

J.
0
 
nurbekCommented:
make sure that session is enabled

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

Response.Write(Session("test"))

%>
0
 
jimbobmcgeeAuthor Commented:
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
 
jimbobmcgeeAuthor Commented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now