Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 01:41 PM
cab
Guest
 
Posts: n/a
Default Sub Session_OnEnd

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.


  #2  
Old July 19th, 2005, 01:41 PM
Evertjan.
Guest
 
Posts: n/a
Default Re: Sub Session_OnEnd

cab wrote on 08 jun 2004 in microsoft.public.inetserver.asp.general:
[color=blue]
> 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?[/color]

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)
  #3  
Old July 19th, 2005, 01:41 PM
Aaron [SQL Server MVP]
Guest
 
Posts: n/a
Default Re: Sub Session_OnEnd

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" <cab_spk@hotmail.com> wrote in message
news:40c55fdb$1@duster.adelaide.on.net...[color=blue]
> 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.
>
>[/color]


  #4  
Old July 19th, 2005, 01:42 PM
cab
Guest
 
Posts: n/a
Default Re: Sub Session_OnEnd

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]" <ten.xoc@dnartreb.noraa> wrote in message
news:u#Ge49VTEHA.1472@TK2MSFTNGP12.phx.gbl...[color=blue]
> 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" <cab_spk@hotmail.com> wrote in message
> news:40c55fdb$1@duster.adelaide.on.net...[color=green]
> > i have the following code in the "Sub Session_OnEnd" routine that does[/color][/color]
not[color=blue][color=green]
> > 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[/color][/color]
been[color=blue][color=green]
> > killed?
> >
> > cheers,
> > cab.
> >
> >[/color]
>
>[/color]


 

Bookmarks

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles