Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Global Variables

Status
Not open for further replies.

SteveD73

Programmer
Jan 5, 2001
109
GB
Hi

How can I setup a global variable so all my pages can access it?

Thanks
 
You could use a session variable in the form...

Session("MyVar") = "Value"

This would allow all pages to access that value, however there is some debate over the use of this type of variable. Search this forum for the word Session Variable for more info.

G -GTM Solutions, Home of USITE-
-=
 
better still, you can set up an application variable in the global.asa file (which must be in the root of your website).

In global.asa, you should have the following (in VBscript):
<SCRIPT LANGUAGE=&quot;VBScript&quot; RUNAT=&quot;Server&quot;>
Sub Application_OnStart
Application(&quot;variablename&quot;) = value
End Sub
</SCRIPT>

etc. You can then access the variable in any page by using application(&quot;variablename&quot;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top