global.asa file

Discussion in 'Classic ASP' started by robsecord, Aug 23, 2003.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I need help with finding the "global.asa" file in my ASP site, if one wasn't provided when registering, do I just create one? And where do I put it? The root of my dir structure is ht_docs i think..

    I basically need to create Application and Session level variables and would like to do it in the Application_OnStart and Session_OnStart subs.

    Could someone who knows about this pleae help me? I greatly appreciate any advice I could receive on this matter [:D].

    R. Secord, B.Sc., CTO MorphixTech
     
  2. Well, Since My Post Above, No One has replied with any information at all regarding Global.asa so now I am back to post information for anyone else who may be interested in the global.asa file.

    It goes in the root directory of your web application (htdocs) and must be named global.asa [;)] If all goes as intended, this file runs automatically on every session start and application restart.
    Within this file, you can call Server-Side Sub-Routines which Initialize your Application and Session level variables, as well as destroy them on end.

    A sample global.asa file would look like this:

    <script language="VBScript" runat="server">

    Sub Application_OnStart
    Application("SomeVar") = "0"
    End Sub

    Sub Session_OnStart
    Session("SomeOtherVar") = "no"
    End Sub

    Sub Session_OnEnd
    Session("SomeOtherVar") = ""
    End Sub

    Sub Application_OnEnd
    Application("SomeVar") = ""
    End Sub
    </script>

    I hope this was helpful to someone, I know it helps my program start properly each time!! Enjoy!

    R. Secord, B.Sc., CTO MorphixTech
     
  3. Bruce

    Bruce DiscountASP.NET Staff

    Yes. You'll need to create that file yourself.

    Global.asa file can only exists in web application root. Your root directory is already set as root. You can use the web application tool to create more web application.

    Hope this helps.


    quote:Originally posted by robsecord

    I need help with finding the "global.asa" file in my ASP site, if one wasn't provided when registering, do I just create one? And where do I put it? The root of my dir structure is ht_docs i think..

    I basically need to create Application and Session level variables and would like to do it in the Application_OnStart and Session_OnStart subs.

    Could someone who knows about this pleae help me? I greatly appreciate any advice I could receive on this matter [:D].

    R. Secord, B.Sc., CTO MorphixTech
    </blockquote id="quote"></font id="quote">
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page