[thelist] [ASP Question] Session_OnStart

Jacques Capesius jacques_capesius at cnt.com
Fri Oct 18 11:10:01 CDT 2002


Hi folks,

I'm trying to do a little stat collecting, using a Session_OnStart trigger
to record in a database the time someone first accessed the site. I figure,
having a global.asa file that looked like this would do the trick...

<SCRIPT LANGUAGE="VBSCRIPT" RUNAT="SERVER">
Sub Session_OnStart
	Set SessionCon = Server.CreateObject("ADODB.Connection")
	SessionCon.Open "Driver={SQL Server}; SERVER=blaa;
DATABASE=whatever; UID=jondoe; PWD=aintellin;"
	SQLQuery = "INSERT INTO Session_stats (sessionID, session_start) "&_
			   "VALUES ('"&Session.SessionID&"',getdate())"
	set theRS = SessionCon.Execute(SQLQuery)
	set theRS = Nothing
	set SessionCon = Nothing
End Sub
</SCRIPT>

As is probably obvious to some of you ASP Wizards, this code isn't
executing, and i'm not really sure why. I'm kinda new to adding code to the
global.asa file and using ASP's version of event handling, so any advice you
folks could give would be greatly appreciated. thanks!



More information about the thelist mailing list