Go Back   CodingForums.com > :: Server side development > ASP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-18-2005, 03:34 AM   PM User | #1
jerriey
New to the CF scene

 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
jerriey is an unknown quantity at this point
Unhappy What's wrong with my Global.asa file?

Hi all,
I am trying to track all my members of my website.

I have a global.asa file:

Code:
<script language="vbscript" runat="server">


Sub Application_OnStart

Application("Conn") = "connection string"
Application("Now") =  Date() & " " & Time()

End Sub

Sub Session_OnStart

Session.Timeout = 20

	if session("ManagerName")<>"" then 


			SQL = "Insert Into  tbl_ManagerTracker (col_timeStart) Values('col_timeStart')"
				
		Set MM_insert = Server.CreateObject("ADODB.Command")
			MM_insert.ActiveConnection = Application("Conn")
			MM_insert.CommandText = SQL
			MM_insert.Execute 
			MM_insert.ActiveConnection.Close
		
		Set MM_insert = Nothing
	
	end if 

End Sub

Sub Session_OnEnd


			Set ManagerEnd = Server.CreateObject("ADODB.Recordset")
			ManagerEnd.ActiveConnection = Application("Conn")
			ManagerEnd.Source = "SELECT  col_timeEnd FROM tbl_Tracker where  col_timeStart  ="&col_timeStart&" "

			ManagerEnd.Locktype = 3
			ManagerEnd.Open()

			ManagerEnd.fields("col_timeEnd")= Application("Now")
			
			ManagerEnd.update()
			ManagerEnd.close()
End Sub

</script>
First of all, my session("ManagerName") been set up by user login, but it's value getting null while the global.asa running.

Then, Sub Session_OnEnd command seems not to be working at all...

I know it is a quite old topic, but please please help!!! Thanks..,

jerriey is offline   Reply With Quote
Old 01-18-2005, 05:57 AM   PM User | #2
glenngv
Supreme Master coder!


 
glenngv's Avatar
 
Join Date: Jun 2002
Location: Los Angeles, CA Original Location: Philippines
Posts: 10,241
Thanks: 0
Thanked 112 Times in 111 Posts
glenngv will become famous soon enough
Session_OnStart is invoked when a user access the very first asp page in the site. Say User A goes to the home page which is an ASP page, before this ASP page is executed, Session_OnStart is executed first. Succeeding access to other asp pages will not invoke that handler until the session times out or abandoned. Therefore in the Session_OnStart handler, you don't need this condition:

if session("ManagerName")<>"" then

But if you only want to track if the user is a manager, then you have to do that after the successful login, not in global.asa.

Session_OnEnd is invoked after the session times out for a user or the session is abandoned (log out). If the user did not log out properly and just closes the browser window, Session_OnEnd is not invoked, only after the session times out for that user. So if the timeout is 20 minutes, the handler will be executed after that time when the user closes the browser.
__________________
Glenn
_____________________________________________
Play Tower of Hanoi Android app (Ad-FREE!)
Play Tower of Hanoi Android app (FREE!)
Go to Tower of Hanoi Leaderboard
Play Tower of Hanoi Facebook app
glenngv is offline   Reply With Quote
Old 01-19-2005, 12:34 AM   PM User | #3
jerriey
New to the CF scene

 
Join Date: Jan 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
jerriey is an unknown quantity at this point
thanks . Seems I have to try different way....
jerriey is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:09 PM.


Advertisement
Log in to turn off these ads.