Hello,
I am working on a website, and my next task is to track the number of online users.
Decided the best approach to do this would be to add a strSessionID field to my customers table. The idea is to populate it with Session.SessionID at login, and then clear it out at Session_End.
Well, it seems I can put the value into my table when a user logs in, but something isn't working in my Session_End event.
Can anyone help?
Here is the code in my Global.asax:
**************************************************
<%@ Application Language="
VB" Inherits="myApp.Application.GlobalAsax" %>
<%@Import NameSpace="myApp.Data" %>
<script language="
VB" runat="server">
Sub Application_Start(Sender As Object, E As EventArgs)
' Application startup code goes here
End Sub
Sub Application_End(Sender As Object, E As EventArgs)
' Clean up application resources here
End Sub
Sub Session_Start(Sender As Object, E As EventArgs)
'Session startup code goes here.
End Sub
Sub Session_End(ByVal Sender as Object, ByVal E as EventArgs)
'' Clear out the matching strSessionID field in tblCustomers.
Dim strSessionID As String = Session.SessionID.ToString().Trim()
Dim sql As String = "UPDATE tblCustomers SET strSessionID = NULL WHERE strSessionID = '" & strSessionID & "'"
myDataHandler.runSql(sql)
End Sub
************************************************
Thank you in advance to anyone who can help shed some light here!
Susan :)