Forums

ASP

This topic is locked

Global.asa HELP !!

Posted 19 Nov 2002 16:10:16
1
has voted
19 Nov 2002 16:10:16 David Stoltz posted:
I am tracking when users log in and log out of a web application.

I know my Global.asa file is firing, but in my Session_OnEnd event I make a connection to a SQL database and it does a table update - and IT'S NOT WORKING - ARGH!

The other lines in the same event work, which just change an application variable.

Is it possible that you can't connect to a DB in this event? Why wouldn't this work?

Thanks for any help!

PS- Here's the event:

sub Session_OnEnd

Application.Lock
Application("visitors"=Application("visitors"-1
Application.UnLock

'UPDATE AUDIT LOG
set conn = Server.CreateObject("ADODB.Connection"
conn.open "my connect string"
sql = "INSERT INTO SQL DATABASE, ETC"
conn.execute(sql)
conn.close

end sub

Replies

Replied 19 Nov 2002 16:52:59
19 Nov 2002 16:52:59 Brent Colflesh replied:
Dear Dstoltz,
It's always been my understanding that you connect in the Session-Start event... The Session-End area is just for closing triggers/events/db close.

Move your db connection code to Session-Start.

Regards,
Brent

Replied 19 Nov 2002 17:19:31
19 Nov 2002 17:19:31 David Stoltz replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>
Dear Dstoltz,
It's always been my understanding that you connect in the Session-Start event... The Session-End area is just for closing triggers/events/db close.

Move your db connection code to Session-Start.

Regards,
Brent


<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

But I want to write to the DB when the user ENDS the session, thus, I have to use the OnEnd event...

I know I can write to a text file in this event, I was just hoping I could write straight to the DB instead...
Replied 19 Nov 2002 20:54:47
19 Nov 2002 20:54:47 Brent Colflesh replied:
Dear Dstoltz,
I don't see why can't do this - just open the connection in the Start event - do the INSERT where it is now...

Regards,
Brent

Reply to this topic