Global.asa- How can a variable be called?

Results 1 to 2 of 2

Thread: Global.asa- How can a variable be called?

  1. #1
    Kami Razvan Guest

    Default Global.asa- How can a variable be called?

    Hi:<BR>I am trying to set a value in the Global.asa so I can use it in all the<BR>pages in a web site as a variable for database querry.<BR><BR>This variable would help me write one site and then use it across many<BR>sites by simply changing that variable in the global.asa.<BR><BR>I am just baffled at why I can&#039t get the variable to work in the pages.<BR><BR>I have the following in the global.asa page:<BR><BR>&#060;SCRIPT LANGUAGE="VBScript" RUNAT="Server"&#062;<BR>Sub Application_OnStart<BR>Application("VAR")="10102"< BR>End Sub<BR>&#060;/SCRIPT&#062;<BR><BR>& then in the other pages I have:<BR><BR>&#060;%=Application("VAR")%&#062;<BR> <BR>& it does not work. Am I missing something?<BR><BR>Thanks ..<BR><BR>Kami

  2. #2
    Markkk Guest

    Default RE: Global.asa- How can a variable be called?

    You must remember that Application and Session variables only exist if the virtual directory is set up as an "ASP Application". If the virtual directory is not specifically setup as an "ASP Application", then you will not have any Application or Session variables; ASP Script will run, but without any Application or Session support.<BR><BR>I suggest that you verify that your virtual directory is setup as an "ASP Application".<BR><BR>Also, make sure that your global.asa file is in the root directory for the ASP Application.<BR><BR>Also, make sure that you are not nesting ASP Applications. That is...make sure that the one ASP Application is not physically located as a subdirectory to another ASP Application. If you nest ASP Applications, you will likely have Application and Session state problems. When ASP Applications are nested, IIS gets confused as to which global.asa file, and which Application and Session variables are valid for the page...the parent ASP Application?, or the nested ASP Application?<BR><BR>Keep in mind that the root web directory (usually C:Inetpubwwwroot) often is considered as an ASP Application itself.<BR><BR>It is a good practice to create virtual directories (ASP Applications) well outside the Inetpub directory. Something like:<BR><BR>C:ASP_App1<BR>D:ASP_AppsApp1<BR>D:ASP _AppsApp2<BR>etc.<BR><BR>I hope this helps!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts