Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Sub Session_OnEnd

Reply
Thread Tools

Sub Session_OnEnd

 
 
cab
Guest
Posts: n/a
 
      06-08-2004
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.


 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      06-08-2004
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 ;-}


--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
Aaron [SQL Server MVP]
Guest
Posts: n/a
 
      06-08-2004
You can't rely on this to fire anyway.

http://www.aspfaq.com/2078
http://www.aspfaq.com/2491

--
http://www.aspfaq.com/
(Reverse address to reply.)




"cab" <(E-Mail Removed)> wrote in message
news:40c55fdb$(E-Mail Removed)...
> 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.
>
>



 
Reply With Quote
 
cab
Guest
Posts: n/a
 
      06-09-2004
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.


"Aaron [SQL Server MVP]" <(E-Mail Removed)> wrote in message
news:u#(E-Mail Removed)...
> You can't rely on this to fire anyway.
>
> http://www.aspfaq.com/2078
> http://www.aspfaq.com/2491
>
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
>
>
> "cab" <(E-Mail Removed)> wrote in message
> news:40c55fdb$(E-Mail Removed)...
> > 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.
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Death To Sub-Sub-Sub-Directories! Lawrence D'Oliveiro Java 92 05-20-2011 06:50 AM
Recognising Sub-Items and sub-sub items using xslt Ben XML 2 09-19-2007 09:35 AM
Session_OnEnd not fired in SQL Server mode steve ASP .Net 0 08-25-2003 12:53 AM
Session variables and Session_OnEnd Hans Kesting ASP .Net 4 08-19-2003 09:48 AM
my session_onend is not working anand ASP .Net 4 07-22-2003 04:47 AM



Advertisments