473,465 Members | 1,921 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problem with global.asa & Session_End

Hello everybody.
With the following code:

=======
Sub Session_OnEnd

Application.Lock
Application("online") = Application("online") - 1
Application.UnLock

' set the flag active = 0
Set dbConn = Server.CreateObject("adoDB.connection")
dbConnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("\mydb.mdb")
dbConn.Open dbConnstr
SQLstr = "UPDATE tbl_sessionid SET active='0' WHERE sessionid ='" &
Session("sID") & "'"
dbConn.Execute(SQLstr)
dbConn.Close

End Sub
=======

the first 3 lines are executed when I force the session.abandon but the
others, that set the active flag in an Access DB to 0 aren't.
the same code works fine if I use it in a separate page.

What's wrong with my global.asa?
Thanks in advance

PGei
Jul 19 '05 #1
7 5357
"PiGei" <ja***************@hotmail.com> wrote in message
news:eP****************@TK2MSFTNGP09.phx.gbl...
Hello everybody.
With the following code:

=======
Sub Session_OnEnd

Application.Lock
Application("online") = Application("online") - 1
Application.UnLock

' set the flag active = 0
Set dbConn = Server.CreateObject("adoDB.connection")
dbConnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("\mydb.mdb")


See #2
http://www.aspfaq.com/show.asp?id=2078

--
Tom Kaminski IIS MVP
http://www.iistoolshed.com/ - tools, scripts, and utilities for running IIS
http://mvp.support.microsoft.com/
http://www.microsoft.com/windowsserv...y/centers/iis/

Jul 19 '05 #2
I read it, I did all the modification but the code isn't fired anyway...
No error message, seimply it doesn't work.

If I put the first 3 lines below the include, then this code too doesn't
work anymore.

I don't know how to solve the problem...
I read in this tip http://www.aspfaq.com/2491 that with SQL is possible
to write in a db in the on_end section.

I'm using Access but I can't fire the writing...

Any suggestion?

THX
PGei

"Tom Kaminski [MVP]" <tomk (A@T) mvps (D.O.T) org> wrote in message
news:bv**********@kcweb01.netnews.att.com...
"PiGei" <ja***************@hotmail.com> wrote in message
news:eP****************@TK2MSFTNGP09.phx.gbl... See #2
http://www.aspfaq.com/show.asp?id=2078

Tom Kaminski IIS MVP

Jul 19 '05 #3
"PiGei" <ja***************@hotmail.com> wrote in message
news:u9**************@TK2MSFTNGP11.phx.gbl...
I read it, I did all the modification but the code isn't fired anyway...


Apparently you didn't read it closely enough:

"Session_OnEnd does not support the request, response or server objects"

You are attempting to use the server object, which is not supported. And
article 2491 does NOT use the server object. That is, it does CreateObject
instead of Server.CreateObject.

Hope this helps.
Regards,
Peter Foti
Jul 19 '05 #4

"Peter Foti" <pe***@Idontwantnostinkingemailfromyou.com> wrote in
message news:10*************@corp.supernews.com...
"PiGei" <ja***************@hotmail.com> wrote in message
news:u9**************@TK2MSFTNGP11.phx.gbl...
I read it, I did all the modification but the code isn't fired
anyway...
Apparently you didn't read it closely enough:

"Session_OnEnd does not support the request, response or server objects"
You are attempting to use the server object, which is not supported. And article 2491 does NOT use the server object. That is, it does CreateObject instead of Server.CreateObject.

Hope this helps.
Regards,
Peter Foti


I reposted the code... but it still doesn't work.
The code under Application.UnLock seems not to be executed because the
field active in the DB doesn't change to 1

I'm desperated...

Sub Session_OnEnd

Application.Lock
Application("collegati") = Application("collegati") - 1
Application.UnLock

'================================================= ======================
=======
' inizio codice per settaggio flag active a 1 in uscita
'================================================= ======================
=======
Set dbConn = CreateObject("adoDB.connection")

dbConnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\inetpub\wwwroot\my.mdb"

dbConn.Open dbConnstr

SQLstr = "UPDATE tbl_sessionid SET active='1' WHERE sessionid ='" &
Session("sID") & "'"

dbConn.Execute(SQLstr)

dbConn.Close
Set dbConn = Nothing
'================================================= ======================
=======
' fine codice per settaggio flag active a 1 in uscita
'================================================= ======================
=======

End Sub
Jul 19 '05 #5
"PiGei" <ja***************@hotmail.com> wrote in message
news:OL*************@TK2MSFTNGP12.phx.gbl...

"Peter Foti" <pe***@Idontwantnostinkingemailfromyou.com> wrote in
message news:10*************@corp.supernews.com...
"PiGei" <ja***************@hotmail.com> wrote in message
news:u9**************@TK2MSFTNGP11.phx.gbl...
I read it, I did all the modification but the code isn't fired

anyway...

Apparently you didn't read it closely enough:

"Session_OnEnd does not support the request, response or server

objects"

You are attempting to use the server object, which is not supported.

And
article 2491 does NOT use the server object. That is, it does

CreateObject
instead of Server.CreateObject.

Hope this helps.
Regards,
Peter Foti


I reposted the code... but it still doesn't work.
The code under Application.UnLock seems not to be executed because the
field active in the DB doesn't change to 1

I'm desperated...

Sub Session_OnEnd

Application.Lock
Application("collegati") = Application("collegati") - 1
Application.UnLock

'================================================= ======================
=======
' inizio codice per settaggio flag active a 1 in uscita
'================================================= ======================
=======
Set dbConn = CreateObject("adoDB.connection")

dbConnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\inetpub\wwwroot\my.mdb"

dbConn.Open dbConnstr

SQLstr = "UPDATE tbl_sessionid SET active='1' WHERE sessionid ='" &
Session("sID") & "'"

dbConn.Execute(SQLstr)

dbConn.Close
Set dbConn = Nothing
'================================================= ======================
=======
' fine codice per settaggio flag active a 1 in uscita
'================================================= ======================
=======

End Sub

The only thing I can think of to try would be to make your code look as much
like the example as possible. First, I would try changing the execute to
look more like the example:

conn.execute sql, , 129

If that doesn't work, I don't know what else to suggest.

Good luck,
Peter

Jul 19 '05 #6
PiGei wrote:
"Peter Foti" <pe***@Idontwantnostinkingemailfromyou.com> wrote in
message news:10*************@corp.supernews.com...
"PiGei" <ja***************@hotmail.com> wrote in message
news:u9**************@TK2MSFTNGP11.phx.gbl...
I read it, I did all the modification but the code isn't fired

dbConnstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=c:\inetpub\wwwroot\my.mdb"

dbConn.Open dbConnstr


In some cases, the OnEnd events run under the context of the
IWAM_machinename account. Since you wish that account to update an Access
database, that account needs to be granted NTFS Change permissions for the
folder containing the database.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #7

"Bob Barrows" <re******@NOyahoo.SPAMcom> wrote in message
news:u5**************@tk2msftngp13.phx.gbl...

In some cases, the OnEnd events run under the context of the
IWAM_machinename account. Since you wish that account to update an Access database, that account needs to be granted NTFS Change permissions for the folder containing the database.


That's exactly the problem.
Updating the permission all runs OK...

Thanks a lot to everybody

PGei
Jul 19 '05 #8

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

Similar topics

2
by: JoRo | last post by:
Hi, I'm trying to add an onclick event to a button control so it will open up a new popup window. Everything works fine except where I add variables to pass on to the popup window. Where I have...
2
by: P. Mellerin | last post by:
Hello, I have been searching online for a whole day and couldn't find an answer for this. I have this hyperlink server control: ...
1
by: Nathan Alden | last post by:
I have an XSD defined as the following: <?xml version="1.0" encoding="UTF-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"...
1
by: Samuel Stanojevic | last post by:
- I'm using .NET Framework 1.1. I just noticed that whenever I change the value of Session.Timeout (no matter which aspx page this happens on), at the end of the request, the 'Session_End'...
2
by: James Hunter Ross | last post by:
Friends, In our Global.asax file we implement Session_End() which grabs our own object and then calls our own logout() method to tidy things up. Code is below. (We wrap this in try/catch, but...
2
by: Amit | last post by:
I have assigned a simple xml into a XmlReader. A switch case loops through the nodes and writes the data to XmlWriter object which is initialized to a xml file. The output xml file is correctly...
16
by: thefritz_j | last post by:
We just converted our VS2003 1.1 VB web project (which was working fine) to VS2005 2.0 and now I get: Parser Error Message: Could not load type '<Namespace>.'. Source Error: Line 1: <%@...
12
by: =?Utf-8?B?QWxleCBNYWdoZW4=?= | last post by:
Hi. I am trying to maintain a list of people who are currently "online" in SQL. I do this by adding a simple entry to a simple PeopleOnline table whenever someone logs in to my site. If they...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...
1
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

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.