473,625 Members | 3,093 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sub Session_OnEnd

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

Sub Session_OnEnd

strConnect = "Driver={SQ L Server};Server= SERVER;Database =database; User
ID=xxxxxx;Pwd=x xxxxxx"

Set objConnEnd = Server.CreateOb ject("ADODB.Con nection")
objConnEnd.Open strConnect

strDelete = "DELETE formdata WHERE formMyCpsID = " & Session.Session ID
objConnEnd.Exec ute

strDelete objConnEnd.Clos e
Set objConnEnd = Nothing

End Sub

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

cheers,
cab.
Jul 19 '05 #1
3 3703
cab wrote on 08 jun 2004 in microsoft.publi c.inetserver.as p.general:
i have the following code in the "Sub Session_OnEnd" routine that does
not seem to run.....

Sub Session_OnEnd

strConnect = "Driver={SQ L Server};Server= SERVER;Database =database;
User
ID=xxxxxx;Pwd=x xxxxxx"

Set objConnEnd = Server.CreateOb ject("ADODB.Con nection")
objConnEnd.Open strConnect

strDelete = "DELETE formdata WHERE formMyCpsID = " &
Session.Session ID objConnEnd.Exec ute

strDelete objConnEnd.Clos e
Set objConnEnd = Nothing

End Sub

...can I access the Session.Session ID 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("te sting") = Session.Session ID & "-!-"
End Sub

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

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

=============== =
not tested ;-}
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2
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" <ca*****@hotmai l.com> wrote in message
news:40******** @duster.adelaid e.on.net...
i have the following code in the "Sub Session_OnEnd" routine that does not
seem to run.....

Sub Session_OnEnd

strConnect = "Driver={SQ L Server};Server= SERVER;Database =database; User
ID=xxxxxx;Pwd=x xxxxxx"

Set objConnEnd = Server.CreateOb ject("ADODB.Con nection")
objConnEnd.Open strConnect

strDelete = "DELETE formdata WHERE formMyCpsID = " & Session.Session ID
objConnEnd.Exec ute

strDelete objConnEnd.Clos e
Set objConnEnd = Nothing

End Sub

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

cheers,
cab.

Jul 19 '05 #3
cab
it thought this might have been the case.
i was testing my code below replacing the Session.Session ID with an actual
value in the database.
sometimes the database entry was deleted, but more often it was not.
thanks.
"Aaron [SQL Server MVP]" <te*****@dnartr eb.noraa> wrote in message
news:u#******** ******@TK2MSFTN GP12.phx.gbl...
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" <ca*****@hotmai l.com> wrote in message
news:40******** @duster.adelaid e.on.net...
i have the following code in the "Sub Session_OnEnd" routine that does not seem to run.....

Sub Session_OnEnd

strConnect = "Driver={SQ L Server};Server= SERVER;Database =database; User
ID=xxxxxx;Pwd=x xxxxxx"

Set objConnEnd = Server.CreateOb ject("ADODB.Con nection")
objConnEnd.Open strConnect

strDelete = "DELETE formdata WHERE formMyCpsID = " & Session.Session ID
objConnEnd.Exec ute

strDelete objConnEnd.Clos e
Set objConnEnd = Nothing

End Sub

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

cheers,
cab.


Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
3060
by: Tom Bates | last post by:
I can successfully delete files using fso.DeleteFile when in an ASP script. But in Session_OnEnd, where I'd *really* like to clean up files, it appears that DeleteFile doesn't work. I've tried every combination I could think of. I've verified the filespecs I'm using by logging to a session log file. BTW, I found out the hard way that I can't reference Request.ServerVariables("APPL_PHYSICAL_PATH") from within Session_OnEnd. I had to copy...
24
2451
by: Nancy Drew | last post by:
hi all i'm trying to keep users from being able to login to a site twice at the same time. everytime a user does a login, i stick their userID into an application scoped array. if they try to login again, i bounce them to an error page. i use the session_onEnd sub within global.asa to remove their userID from the array at the end of their session, and this seems to work fine. however, if i just shut down the browser, the sub_onEnd...
14
3953
by: Agoston Bejo | last post by:
Hi! Why doesn't the following code work? Sub Session_OnEnd Dim Conn Set Conn = Server.CreateObject("ADODB.Connection") Conn.ConnectionString = Application("Connection_String") Conn.Open 'here is the error .... End Sub
4
6791
by: Propin | last post by:
Have a problem with below code in global.asa. Same problem as described in this news group before, IWAM_machinename did not solve my problem. Have created the following test code (file is never deleted on my IIS6 Win2003 environment, any idea?): <SCRIPT LANGUAGE="VBScript" RUNAT="Server"> Sub Application_OnStart End Sub
4
2570
by: anand | last post by:
In my website i want to trace the event when user log off from the site by closing the explorer so i am unable to run any server side program at that time and my session_onend event also not working can any one tell me why the session_onend is not working. Thanx in advance
6
2582
by: Martin | last post by:
Hi, Since I went ASP.NET with my global.asa (making it a global.asax) the application events are called just fine as well as the Session_OnStart event but the Session_OnEnd event is not. What is wrong? My global.asax looks like this: <%@ Application src="app.cs" Inherits="mwte.App" %>
1
2132
by: Andy Kasotia | last post by:
My Session_OnStart works but Session_OnEnd does not work. Here's the code...can anyone tell me what's wrong with my code or if anything else on the server that needs to be changed. The Session_OnStart does create the folder for me with the SessionID as the folder name but Session_OnEnd does not delete that folder. Sub Session_OnStart Dim fso, f, DirToCreate 'Create a folder to store PDF Files Set fso =...
11
2094
by: David Thielen | last post by:
Hi; Is there some kind of session ID variable that I can get in the code behind and that is available in Session_OnEnd() to know what session ended? -- thanks - dave david_at_windward_dot_net http://www.windwardreports.com
4
1637
by: Chris Ashley | last post by:
There seem to be isolated occurences of Session_OnEnd not firing in my app. This is problematic because some clean up of resources happens here. I know the Session events were unreliable in classic ASP, but is this still the case in ASP.Net? What kind of scenarios would case Session_OnEnd not to fire? Would Application_Error being hit cause Session_OnEnd not to fire?
0
8192
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8696
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8358
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6119
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1805
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1504
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.