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

Re: Problem with global.asa & Session_End by Tom

Tom
Thu Feb 05 08:52:15 CST 2004

"PiGei" <james_milanNOSPAM@hotmail.com> wrote in message
news:ePNdak%236DHA.2496@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/windowsserver2003/community/centers/iis/




Re: Problem with global.asa & Session_End by PiGei

PiGei
Thu Feb 05 09:24:32 CST 2004

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:bvtkug$qgb10@kcweb01.netnews.att.com...
> "PiGei" <james_milanNOSPAM@hotmail.com> wrote in message
> news:ePNdak%236DHA.2496@TK2MSFTNGP09.phx.gbl...

> See #2
> http://www.aspfaq.com/show.asp?id=2078
>
> Tom Kaminski IIS MVP



Re: Problem with global.asa & Session_End by Peter

Peter
Thu Feb 05 09:36:43 CST 2004

"PiGei" <james_milanNOSPAM@hotmail.com> wrote in message
news:u9pXmw$6DHA.2404@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



Re: Problem with global.asa & Session_End by PiGei

PiGei
Thu Feb 05 09:57:44 CST 2004


"Peter Foti" <peter@Idontwantnostinkingemailfromyou.com> wrote in
message news:1024or98dda1l85@corp.supernews.com...
> "PiGei" <james_milanNOSPAM@hotmail.com> wrote in message
> news:u9pXmw$6DHA.2404@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



Re: Problem with global.asa & Session_End by Peter

Peter
Thu Feb 05 10:10:13 CST 2004

"PiGei" <james_milanNOSPAM@hotmail.com> wrote in message
news:OLaSJDA7DHA.360@TK2MSFTNGP12.phx.gbl...
>
> "Peter Foti" <peter@Idontwantnostinkingemailfromyou.com> wrote in
> message news:1024or98dda1l85@corp.supernews.com...
> > "PiGei" <james_milanNOSPAM@hotmail.com> wrote in message
> > news:u9pXmw$6DHA.2404@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






Re: Problem with global.asa & Session_End by Bob

Bob
Thu Feb 05 10:26:15 CST 2004

PiGei wrote:
> "Peter Foti" <peter@Idontwantnostinkingemailfromyou.com> wrote in
> message news:1024or98dda1l85@corp.supernews.com...
>> "PiGei" <james_milanNOSPAM@hotmail.com> wrote in message
>> news:u9pXmw$6DHA.2404@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.



Re: Problem with global.asa & Session_End by PiGei

PiGei
Thu Feb 05 10:54:07 CST 2004


"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote in message
news:u5D$HTA7DHA.2924@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