server side script ignored

Discussion in 'ASP General' started by jopek, Feb 20, 2004.

  1. jopek

    jopek Guest

    pardon the simple question


    I am just getting into ASP and i am having a bit of a problem.
    If I set variables in the Application_OnStart() in the global.asa which
    is run on the server and then I try to display or use the variables in a
    page the variables do not seem to exist.
    I get the same problem even if I run examples from the wrox ProAsp 3.0
    book.

    An example would be:

    in global.asa or within test.asp

    <% LANGUANGE="VBScript" runat="server" %>
    <Script>
    sub Application_onStart()
    Application("Name") = "test"
    end sub
    </Script>

    test.asp

    ..
    ..
    ..
    <H1> Application Name: <% = Application("Name") %> </H>
    ..
    ..
    ..

    The only thing displayed is the "Application Name:"

    Is this a configuration problem?


    thank you for your help

    john
     
    jopek, Feb 20, 2004
    #1
    1. Advertisements

  2. Hi,
    I use global.asa thus:
    <script language="VBScript" runat="Server">
    Sub Application_OnStart
    Application("VisitantesAtivos") = 0
    Application("TotalVisitas") = 0
    End Sub

    Sub Application_OnEnd
    End Sub

    Sub Session_OnStart
    Application.Lock
    Session.Timeout = 60 '»»60 min. = 1 h. Tempo de expiração da session padrão
    no site da hi-tec.
    Application("VisitantesAtivos") = Application("VisitantesAtivos") + 1
    Application("TotalVisitas") = Application("TotalVisitas") + 1
    Application.UnLock
    End Sub

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

    </script>
    -----------------------------
    so you can write the values in any places of you asp application:
    <%=Application("VisitantesAtivos")%>

    bye,

    --

    Sem mais,

    ««««««««»»»»»»»»»»»»»»
    Vlmar Brazão de Oliveira
    Desenvolvimento Web
    HI-TEC
     
    Vilmar Brazão de Oliveira, Feb 20, 2004
    #2
    1. Advertisements

  3. Have you restarted the application since adding this code to the global.asa?
    Usually it's not necessary, but, it can't hurt to try.

    Bob Barrows
     
    Bob Barrows [MVP], Feb 20, 2004
    #3
  4. jopek

    jopek Guest

    thanks for the response.
    I did try that a few times.
    This doesn't seem to make sense.

    J
     
    jopek, Feb 20, 2004
    #4
  5. jopek

    jopek Guest

    Thank you for your response.

    I have almost the exact code you have and it
    still does not work!

    Strange!!!
     
    jopek, Feb 20, 2004
    #5
  6. jopek

    Mark Schupp Guest

    Is the directory containing the global.asa file defined as an application in
    IIS (icon in IIS manager should be an activeX "ball" in a box)?
     
    Mark Schupp, Feb 20, 2004
    #6
  7. jopek

    jopek Guest

    Mark,

    thank you.
    Okay, I just realized my problem. I was trying to run the site from
    Interdev. when I run the site/app from a ie it works fine.
    So, what is the secret to getting this to work within Interdev?

    thanks again


    John
     
    jopek, Feb 20, 2004
    #7
  8. jopek

    jopek Guest

    guess i had to turn on server side debugging.

    thanks again


    john
     
    jopek, Feb 20, 2004
    #8
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.