469,958 Members | 2,087 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,958 developers. It's quick & easy.

Can't reach variables from global.asax

I try to control the number of how many users are on the site at the moment. To do so I have use the global.asax like this:

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
  2. <html>
  3. <head>
  4. <title>Untitled Document</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <script language="VB" runat="server">
  7. Sub Application_Start()
  8.   Application.Lock()
  9.   Application("datum")=Now()
  10.   Application("on")=0
  11.   Application("namn")="Spider-applikationen"
  12.   Application.UnLock()
  13. End Sub
  14. Sub Session_Start()
  15.   Application.Lock()
  16.   Application("on")=Application("on") + 1
  17.   Application.UnLock()
  18. End Sub
  19. Sub Session_End()
  20.   Application.Lock()
  21.   Application("on")=Application("on") - 1
  22.   Application.UnLock()
  23. End Sub
  24. </script>
  25. </head>
  26. <body>
  27. </body>
  28. </html>
Then I try to reach the values of from my loged_in.aspx like this:

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" %>
  2. <html>
  3. <head>
  4. <title>Welcome</title>
  5. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  6. <script runat="server">
  7. Sub Page_Load()
  8.   Session("logon") = Request("logon")
  9.   logon.Text = Session("logon")
  10.   sessid.Text = Session.SessionID
  11.   app.Text = Application("namn")
  12.   datum.Text = Application("datum")
  13.   aktiva.Text = Application("on")
  14. End Sub
  15. </script>
  16. </head>
  17. <body>
  18. <form runat="server">
  19.   You are <asp:label ID="logon" runat="server"/>
  20.    with sessionsid: <asp:label ID="sessid" runat="server"/>
  21.    in the application <asp:label ID="app" runat="server"/>.<br/>
  22.   The applicationen has been running since <asp:label ID="datum" runat="server"/>.<br/>
  23.   The number of active users in this application: <asp:label ID="aktiva" runat="server"/><br/>
  24. <a href="loggaut.aspx">Log out</a>
  25. </form>
  26. </body>
  27. </html>
BUT all the variables from the global.asax are emtpy :confused: : Like
-datum
-aktiva

I am sure this basic for you, but I have been trying to find the solution for a while now.
//Matti
May 14 '06 #1
0 1857

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

25 posts views Thread by Sahil Malik [MVP] | last post: by
1 post views Thread by WJ | last post: by
8 posts views Thread by Simone Chiaretta | last post: by
3 posts views Thread by Craig | last post: by
4 posts views Thread by Kim Bach Petersen | last post: by
2 posts views Thread by Nathan Sokalski | last post: by
3 posts views Thread by Jack | last post: by
reply views Thread by rainxy | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.