Session_OnEnd, Quick ?

Results 1 to 3 of 3

Thread: Session_OnEnd, Quick ?

  1. #1
    serious Guest

    Default Session_OnEnd, Quick ?

    Ok Gurus, here&#039;s the problem. Take a look at my global.asa:<BR><BR>&#060;!-- METADATA TYPE="typelib" FILE="C:Program FilesCommon FilesSystemadomsado15.dll" --&#062;<BR><BR>&#060;SCRIPT Language=VBScript RUNAT=Server&#062;<BR><BR>Sub Session_OnStart<BR><BR> Session.Timeout = 30<BR><BR>End Sub<BR><BR>Sub Session_OnEnd<BR><BR> Dim rsItem, strCriteria, objConn<BR><BR> Set objConn = Server.CreateObject("ADODB.Connection")<BR> objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _<BR> "Data Source=c:/Inetpub/wwwroot/clients_assignments/ect410/finalproject/database/KritikalMarket.mdb"<BR> <BR> Set rsItem = Server.CreateObject("ADODB.Recordset")<BR><BR> rsItem.Open "KritikalCart", objConn, adOpenStatic, adLockOptimistic, adCmdTable<BR><BR> strCriteria = "UserName =&#039;" & Session("UserName") & "&#039;" <BR><BR> rsItem.Filter = strCriteria<BR><BR> While Not rsItem.EOF <BR> rsItem.Delete<BR> rsItem.MoveNext<BR> Wend<BR> <BR> <BR> objConn.Close<BR> rsItem.Close<BR> Set objConn = Nothing<BR> Set rsItem = Nothing<BR><BR> Session.Content.RemoveAll<BR>End Sub<BR><BR>&#060;/SCRIPT&#062;<BR><BR>This as you might of expected doesn&#039;t work! My Problem: I&#039;m trying to delete the contents of a table for a particular user at the end of a session. How should I go about doing this?

  2. #2
    Join Date
    Dec 1969

    Default By giving up

    Session On End has been buggy since the start... sometimes it fires, sometimes it doesn&#039;t. You&#039;ll have to find another way to do clean up.. maybe like a final page on unload or so...

  3. #3
    Join Date
    Dec 1969

    Default RE: Session_OnEnd, Quick ?

    Although messy you could update a field in the db each time a user does something with the current date time. Then on session onstart delete all users where current time - time in that field &#062; session timeout ie 30 min. Could pad this just in case. however hit the db each page and each session on start. Could also possibly do something to track users with an application var but still messy. Are you storing info in a table to avoid session vars, why not use cookies instead?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts