Sub Session_OnEnd

C

cab

i have the following code in the "Sub Session_OnEnd" routine that does not
seem to run.....

Sub Session_OnEnd

strConnect = "Driver={SQL Server};Server=SERVER;Database=database; User
ID=xxxxxx;Pwd=xxxxxxx"

Set objConnEnd = Server.CreateObject("ADODB.Connection")
objConnEnd.Open strConnect

strDelete = "DELETE formdata WHERE formMyCpsID = " & Session.SessionID
objConnEnd.Execute

strDelete objConnEnd.Close
Set objConnEnd = Nothing

End Sub

....can I access the Session.SessionID at this stage or has it already been
killed?

cheers,
cab.
 
E

Evertjan.

cab wrote on 08 jun 2004 in microsoft.public.inetserver.asp.general:
i have the following code in the "Sub Session_OnEnd" routine that does
not seem to run.....

Sub Session_OnEnd

strConnect = "Driver={SQL Server};Server=SERVER;Database=database;
User
ID=xxxxxx;Pwd=xxxxxxx"

Set objConnEnd = Server.CreateObject("ADODB.Connection")
objConnEnd.Open strConnect

strDelete = "DELETE formdata WHERE formMyCpsID = " &
Session.SessionID objConnEnd.Execute

strDelete objConnEnd.Close
Set objConnEnd = Nothing

End Sub

...can I access the Session.SessionID at this stage or has it already
been killed?

I don't know, but you could test this by global.asa:

Sub Session_OnEnd
application("testing") = Session.SessionID & "-!-"
End Sub

===============
In an asp-page test this with:

if application("testing") = "" then
respons.write "No session ended yet. Please try later."
elseif application("testing") = "-!-" then
respons.write "Session.SessionID not available in Session_OnEnd"
else
respons.write "Yes, Session.SessionID is available in Session_OnEnd"
end if

================
not tested ;-}
 
C

cab

it thought this might have been the case.
i was testing my code below replacing the Session.SessionID with an actual
value in the database.
sometimes the database entry was deleted, but more often it was not.
thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top