473,387 Members | 1,515 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Can if statements be used in global.asa?

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).
Jul 19 '05 #1
3 3339
Lord Merlin wrote:
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
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #2
The Request object is available in global.asa - at least in Session_OnStart.

Bob Lehmann

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:O3**************@TK2MSFTNGP10.phx.gbl...
Lord Merlin wrote:
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
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 19 '05 #3
I stand corrected. The Request object is available in Session_OnStart.

Bob Barrows

Bob Lehmann wrote:
The Request object is available in global.asa - at least in
Session_OnStart.

Bob Lehmann

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:O3**************@TK2MSFTNGP10.phx.gbl...
Lord Merlin wrote:
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
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so
I don't check it very often. If you must reply off-line, then remove
the "NO SPAM"


--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: dmbkiwi | last post by:
I am new to this group, and relatively new to python programming, however, have encountered a problem I just cannot solve through reading the documentation, and searching this group on google. I...
10
by: Not Available | last post by:
On the host server: namespace JCart.Common public class JCartConfiguration : IConfigurationSectionHandler private static String dbConnectionString; public static String ConnectionString { get...
9
by: Simon | last post by:
Hi, I have written an ActiveX object to resize images and upload them to a database, this all works fine but when I close internet explorer the process iexporer.exe is still running in my task...
3
by: xenophon | last post by:
I tried to put "using System.IO;" in my global.asax and Visual Studio 2005 would not let me compile. Why? Thanks.
6
by: Joe Befumo | last post by:
I just created the default personal site project in Visual Studio 2005, and it worked perfectly -- very nice. Next, I'd like to import some stat-capture code that I have working in a Visual Studio...
4
by: Raj | last post by:
Can we create an event monitor for statements in a partitioned environment? CREATE EVENT MONITOR stmt_event FOR STATEMENTS WRITE TO FILE '/home/rajm/event' ON PARTITION 0 GLOBAL DB21034E ...
4
by: Sheldon | last post by:
Hi, I have a series of classes that are all within the same file. Each is called at different times by the main script. Now I have discovered that I need several variables returned to the main...
0
by: Gary Herron | last post by:
Ohad Frand wrote: There is no way you can consider 'elif', 'else', 'except', and 'from' statements. However, as someone pointed out, the kwlist from the keyword module is the closest thing we...
0
by: Ohad Frand | last post by:
Hi Thanks a lot for your reply I think the main uses for it is to study the language and to see that I didn't miss anything else or that something is changed from one version to another. The...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.