(0x8002802B) Element not found

M

Mr. Smart

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


The above is what I always get when I tried to log on to my website. I am
still developing it using localhost. So the very first time I typed
http://localhost, it will give me the error above.
Here is what I i have in the file (Session_OnStart):

....

StartPage = "http://" & Request.ServerVariables("SERVER_NAME") &
"/Default.asp"
Session("referer") = Request.ServerVariables("HTTP_REFERER")
currentPage = "http://" & Request.ServerVariables("SERVER_NAME") &
Request.ServerVariables("SCRIPT_NAME")
....

Even if I comment the Startpage = ..., and I re-start the app, it jumps to
the next line.

Here is what I am trying to do. I want to be able to monitor how many people
logged on to my website at any momemt. Also I want to make sure users logged
in and monitor where they are coming from. So, I have the above lines. Down
below, I have the following lines

if strcomp(currentPage,startPage,1) then
Application.Lock
Application("NofUsers") = Application("NofUsers") + 1
Application.UnLock
Response.Redirect(startPage)
else
Application.Lock
Application("NofUsers") = Application("NofUsers") + 1
Application.UnLock
end if

If they did not come in thru the start page Default.asp, it pushes the user
to default.asp, else it increases nofusers. However, as I indicated above, it
gives the error above. However, if I click on Refresh, it works correctly.
Any ideas?
 
B

Bob Barrows [MVP]

Mr. Smart said:
Error Type:
(0x8002802B)
Element not found.
//global.asa, line 28


The above is what I always get when I tried to log on to my website.
I am still developing it using localhost. So the very first time I
typed http://localhost, it will give me the error above.
Here is what I i have in the file (Session_OnStart):

...

StartPage = "http://" & Request.ServerVariables("SERVER_NAME") &
"/Default.asp"
Session("referer") = Request.ServerVariables("HTTP_REFERER")
currentPage = "http://" & Request.ServerVariables("SERVER_NAME") &
Request.ServerVariables("SCRIPT_NAME")
...
Does any of this apply?
http://classicasp.aspfaq.com/general/why-does-global-asa-not-fire.html
 
D

Daniel Crichton

Mr. wrote on Wed, 23 Jul 2008 06:22:04 -0700:
Error Type:
(0x8002802B)
Element not found.
//global.asa, line 28

The above is what I always get when I tried to log on to my website. I
am still developing it using localhost. So the very first time I typed
http://localhost, it will give me the error above.
Here is what I i have in the file (Session_OnStart):

Rather than posting snippets, can you post the entire global.asa file in
case there's something else that is causing the problem, and also point out
which is line 28 (I'm assuming it's the "StartPage = ..." line, but you
didn't clearly state that? According to http://support.microsoft.com/kb/275519
you should only get this error if trying to use the Request object in the
Application events, not in the Session events, which is why it's worth
posting the complete unedited global.asa content in case there's a typo
somewhere else.
 
M

Mr. Smart

As a poster has suggested, here is the full listing. I posted it 'as-is'.
CONFESSION TIME: The code here is 'very ugly'. There are a lot of extranous
code because I am testing a lot of things. Please disregard all
FileOut.WriteLine code. It has nothing do do with the problem and in the
production code, all those ones will be removed. The FileOut.WriteLine code
are simply to monitor the code (debugging). Since everything is out in the
open, I will also add some other problems that I am encountering. I just
wanted to take them one by one, in the order of importance.

As I indicated, I want to monitor the number of visitors at any particular
time I logged in. So if opened many browsers to simulate many users logging
in, it seems that Session_OnEnd runs immediately after (I did not remove the
default of 20 mins), however that is the least of the propblem. Take a look
at the contents of SessionStart.txt (appears at the end of the code listing

<SCRIPT LANGUAGE=VBScript RUNAT=Server>

'You can add special event handlers in this file that will get run
automatically when
'special Active Server Pages events occur. To create these handlers, just
create a
'subroutine with a name from the list below that corresponds to the event
you want to
'use. For example, to create an event handler for Session_OnStart, you would
put the
'following code into this file (without the comments):

Sub Session_OnStart

debugfilename = "C:\SessionStart.txt"
set FileObject = Server.Createobject("Scripting.FileSystemObject")
Set Fileout = FileObject.OpenTextFile(debugfilename,8,true)
FileOut.WriteLine(session.SessionID)
FileOut.WriteLine("Date: " & date())
FileOut.WriteLine("Time: " & time())
FileOut.WriteLine("================")
' FileOut.WriteLine(" Session Start Initiated")


'Dim StartPage, currentPage
'Session.Timeout = 60
' FileOut.WriteLine(" Session('referer') about to be executed")
' FileOut.WriteLine(Request.ServerVariables("HTTP_REFERER"))
' Session("referer") = Request.ServerVariables("HTTP_REFERER")
' FileOut.WriteLine(" Session('referer') just executed")
' FileOut.WriteLine(" StartPage = is about to be executed")
StartPage = "http://" & Request.ServerVariables("SERVER_NAME") &
"/Default.asp"
Session("referer") = Request.ServerVariables("HTTP_REFERER")


' FileOut.WriteLine("The StartPage is " & StartPage)


Session("website") = "http://" & Request.ServerVariables("SERVER_NAME")
currentPage = "http://" & Request.ServerVariables("SERVER_NAME") &
Request.ServerVariables("SCRIPT_NAME")

' FileOut.WriteLine("The CurrentPage is " & CurrentPage)

' Do a case-insensitive compare, and if they
' don't match, send the user to the start page.
if strcomp(currentPage,startPage,1) then
FileOut.WriteLine(strcomp(currentPage,startPage,1))
Application.Lock
Application("NofUsers") = Application("NofUsers") + 1
Application.UnLock


FileOut.WriteLine("NofUsers:")
FileOut.WriteLine(Application("NofUsers"))
'FileOut.WriteLine(" Session Completed")

' FileOut.WriteLine(startPage)
' we are temporarily comment this out. This will enable us do some
debugging.
' If this were there, it will always go to the main page.
fileout.close
Response.Redirect(startPage)

else
'FileOut.WriteLine(strcomp(currentPage,startPage,1))
Application.Lock
Application("NofUsers") = Application("NofUsers") + 1

Application.UnLock

FileOut.WriteLine("NofUsers: ")
FileOut.WriteLine(Application("NofUsers"))
' FileOut.WriteLine(" Session Completed")
end if
fileout.close

'
End Sub

Sub Session_OnEnd
debugfilename = "C:\SessionEnd.txt"
set FileObject = Server.Createobject("Scripting.FileSystemObject")
Set Fileout = FileObject.OpenTextFile(debugfilename,8,true)
FileOut.WriteLine(" Session Initiated")


Application.Lock
Application("NofUsers") = Application("NofUsers") - 1
Application.UnLock


FileOut.WriteLine(" Session Completed")

END Sub
Sub Application_OnStart
debugfilename = "C:\ApplicationStart.txt"
set FileObject = Server.Createobject("Scripting.FileSystemObject")
Set Fileout = FileObject.OpenTextFile(debugfilename,8,true)

FileOut.WriteLine(session.SessionID)
FileOut.WriteLine(" Application_OnStart Entered")
Application("ConnectionString") = "Driver={Microsoft Visual FoxPro
Driver};SourceType=DBC;SourceDb=" & Server.MapPath("Tables") &
"\Perfectjobs.dbc"
Application("AppTitle") = "www.getemployedfast.net"
Application("NofUsers") = 0

FileOut.WriteLine(Application("ConnectionString"))
FileOut.WriteLine(Application("NofUsers"))
FileOut.WriteLine(" Application_OnStart Completed")
FileOut.close
Application("Directory") = Server.MapPath("/")
' stop
' Set Application("app") = Server.CreateObject("Sendmails.Mails")
End Sub

'EventName Description
Session_OnStart 'Runs the first time a user runs any page in your
application
Session_OnEnd 'Runs when a user's session times out or quits your
application
Application_OnStart 'Runs once when the first page of your application is
run for the first time by any user
'Application_OnEnd 'Runs once when the web server shuts down

</SCRIPT>

============ Here is the copied and pasted file. Truncated of course because
I have been running the code for some time


================
NofUsers:
1
1043035979
Date: 7/23/2008
Time: 4:57:38 PM
================
NofUsers:
2
1043035979
Date: 7/23/2008
Time: 4:57:38 PM
================
NofUsers:
1
1043035981
Date: 7/23/2008
Time: 5:00:05 PM
================
NofUsers:
2
1043035981
Date: 7/23/2008
Time: 5:00:05 PM
================
NofUsers:
1
1043035979
Date: 7/23/2008
Time: 5:18:37 PM
================
1043035981
Date: 7/23/2008
Time: 5:20:35 PM
================
 
B

Bob Barrows [MVP]

Mr. Smart said:
As a poster has suggested, here is the full listing. I posted it
'as-is'. CONFESSION TIME: The code here is 'very ugly'. There are a
lot of extranous code because I am testing a lot of things. Please
disregard all FileOut.WriteLine code. It has nothing do do with the
problem and in the production code, all those ones will be removed.
The FileOut.WriteLine code are simply to monitor the code
(debugging). Since everything is out in the open, I will also add
some other problems that I am encountering. I just wanted to take
them one by one, in the order of importance.

As I indicated, I want to monitor the number of visitors at any
particular time I logged in. So if opened many browsers to simulate
many users logging in, it seems that Session_OnEnd runs immediately
after (I did not remove the default of 20 mins), however that is the
least of the propblem. Take a look at the contents of
SessionStart.txt (appears at the end of the code listing

Here is some informative reading:
http://classicasp.aspfaq.com/general/what-is-wrong-with-session-onend.html
http://www.aspfaq.com/show.asp?id=2491

I'm sorry but I have no further conjectures as to what could be wrong.
 
J

Jeff Dillon

Mr. Smart said:
Error Type:
(0x8002802B)
Element not found.
//global.asa, line 28


The above is what I always get when I tried to log on to my website. I am
still developing it using localhost. So the very first time I typed
http://localhost, it will give me the error above.
Here is what I i have in the file (Session_OnStart):

...

StartPage = "http://" & Request.ServerVariables("SERVER_NAME") &
"/Default.asp"
Session("referer") = Request.ServerVariables("HTTP_REFERER")
currentPage = "http://" & Request.ServerVariables("SERVER_NAME") &
Request.ServerVariables("SCRIPT_NAME")
...

Even if I comment the Startpage = ..., and I re-start the app, it jumps to
the next line.

Here is what I am trying to do. I want to be able to monitor how many
people
logged on to my website at any momemt. Also I want to make sure users
logged
in and monitor where they are coming from. So, I have the above lines.
Down
below, I have the following lines

if strcomp(currentPage,startPage,1) then
Application.Lock
Application("NofUsers") = Application("NofUsers") + 1
Application.UnLock
Response.Redirect(startPage)
else
Application.Lock
Application("NofUsers") = Application("NofUsers") + 1
Application.UnLock
end if

If they did not come in thru the start page Default.asp, it pushes the
user
to default.asp, else it increases nofusers. However, as I indicated above,
it
gives the error above. However, if I click on Refresh, it works correctly.
Any ideas?

What is on line 28? What element is not being found? Easy to test by
commenting out appropriate lines of code.
 
D

Daniel Crichton

I've cut out most of the previous post to keep this short and to the point.
'EventName Description
Session_OnStart 'Runs the first time a user runs any page in
your
application
Session_OnEnd 'Runs when a user's session times out or quits
your
application
Application_OnStart 'Runs once when the first page of your
application is
run for the first time by any user
'Application_OnEnd 'Runs once when the web server shuts down
</SCRIPT>


Is the above verbatim from your global.asa? Do you actually have those lines
in it? If so, does it cure the problem if you remove them? All the lines
that don't start with ' will be treated as code to run, and outside of the
defined events I can only assume that what is happening is they are being
treated as part of the application start up, in which case it's firing
Session_OnStart outside of a session which makes the Request object invalid
and would give you that error.
 
M

Mr. Smart

Thanks very much to all of you out there who have contributed. You are
marvellous - Bob Barrows, Dan Critcton and Jeff Dillion. Thanks. Where I got
it wrong was the codes outside Script /Script. I thought that to call the 4
procedures, I would have to call them each one at a time. That was why I did
not comment out ApplicationStart, SessionStart and SessionEnd as Mr. Daniel
Cricton pointed out. Merely commenting those lines out solved the problem.
Once again, thanks.
 
D

Daniel Crichton

Glad to hear that resolved it. It did look odd that you had those in there.

Global.asa can contain code that is run, as well as the event routines for
the Application and Session. You do not include calls to the event
routines - the ASP.DLL parser does this for you. Code outside of the event
routines is normally used to set constants and variables for use elsewhere
throughout the application which is why it is not ignored.

Dan

Mr. wrote on Thu, 24 Jul 2008 02:51:00 -0700:
 

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,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top