Pages

Wednesday, October 24, 2007

Sample Code to Kill/Destroy ASP sessions

Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends

Try
'FormsAuthentication.SignOut()
Dim userObj As cUser = Session.Item("user")
If Not userObj Is Nothing Then
If Not Session("LogOut") = "True" Then
userObj.SaveUsageTrackingOnly(userObj.memberInfo.mUserName, "Session timeout", "Session timeout", "", , , Session("ClientAddress"))
End If
End If
userObj = Nothing

Session("Logout") = Nothing
'Reset system search session variable
Session("SystemSearchResult") = Nothing

Catch excobj As Exception
Dim j As Integer = 0

End Try
End Sub

No comments:

Post a Comment