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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If variable exist then do something.. else do nothing?.

Status
Not open for further replies.

gus121

Technical User
May 9, 2002
298
GB
Hi i have a function which i am including on multiple ASP pages via an include file and is been called on multiple pages.

However i wish to run a little bit of logic if a particular variable exists. however i dont want to have to go through and declare the varible on all my pages or remove the option explicit i have setup on my pages.

Is there a way to say if var exists then run code block?

Thanks

Angus



-Gus
 
may be you could do this in the global.asa file

something like this:
Code:
Sub Session_OnStart
    ...
    Session("myvariable") = True
    ...
End Sub
and on all your pages you could do:
Code:
if Session("myvariable")=true then
'do this 
else
'do that
end if
-DNG
 
Hi thanks for your input.

I decided to declare the variable on each page instead using a include file which is attached on all pages.

Thanks for your time.

Kind regards

Angus

-Gus
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top