Can if statements be used in global.asa?

L

Lord Merlin

When using "if then" statements in global, I get the following error:

a.. Error Type:
(0x8002802B)
Element not found.
//global.asa, line 12


Can I use if then statements in global?

Here is the statement:

if request.ServerVariables("HTTP_HOST") = "localhost" then

Application("question") = "Provider=SQLOLEDB.1;Persist Security
Info=False;User ID='********';'Password='***********';Initial
Catalog='******';Data Source=localhost"

else
Application("question") = "Provider=SQLOLEDB.1;Persist Security
Info=False;User ID='**********';Password='**********';Initial
Catalog='*****';Data Source=<remote-host>"
end if

--

Kind Regards
Rudi Ahlers
+27 (82) 926 1689

Greater love has no one than this, that he lay down his life for his friends
(John 15:13).
 
B

Bob Barrows [MVP]

Lord said:
When using "if then" statements in global, I get the following error:

a.. Error Type:
(0x8002802B)
Element not found.
//global.asa, line 12


Can I use if then statements in global?

Here is the statement:

if request.ServerVariables("HTTP_HOST") = "localhost" then
:)
It's not the if...then that's causing the problem. It's the attempt to use
the Request object, which is not available in global.asa. The Request object
is only available in pages that are called (requested) by a client. Don't
forget: global.asa is not called by the client: it runs when one of the 4
events takes place (session start and end, application start and end). There
is no Request opject associated with these events.

Bob Barrows
 
B

Bob Lehmann

The Request object is available in global.asa - at least in Session_OnStart.

Bob Lehmann
 
B

Bob Barrows [MVP]

I stand corrected. The Request object is available in Session_OnStart.

Bob Barrows
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top