473,605 Members | 2,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with global.asa & Session_End

Hello everybody.
With the following code:

=======
Sub Session_OnEnd

Application.Loc k
Application("on line") = Application("on line") - 1
Application.UnL ock

' set the flag active = 0
Set dbConn = Server.CreateOb ject("adoDB.con nection")
dbConnstr = "Provider=Micro soft.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 5369
"PiGei" <ja************ ***@hotmail.com > wrote in message
news:eP******** ********@TK2MSF TNGP09.phx.gbl. ..
Hello everybody.
With the following code:

=======
Sub Session_OnEnd

Application.Loc k
Application("on line") = Application("on line") - 1
Application.UnL ock

' set the flag active = 0
Set dbConn = Server.CreateOb ject("adoDB.con nection")
dbConnstr = "Provider=Micro soft.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.netn ews.att.com...
"PiGei" <ja************ ***@hotmail.com > wrote in message
news:eP******** ********@TK2MSF TNGP09.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******** ******@TK2MSFTN GP11.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_On End 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.CreateOb ject.

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

"Peter Foti" <pe***@Idontwan tnostinkingemai lfromyou.com> wrote in
message news:10******** *****@corp.supe rnews.com...
"PiGei" <ja************ ***@hotmail.com > wrote in message
news:u9******** ******@TK2MSFTN GP11.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_On End 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.CreateOb ject.

Hope this helps.
Regards,
Peter Foti


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

I'm desperated...

Sub Session_OnEnd

Application.Loc k
Application("co llegati") = Application("co llegati") - 1
Application.UnL ock

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

dbConnstr = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\inetp ub\wwwroot\my.m db"

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******** *****@TK2MSFTNG P12.phx.gbl...

"Peter Foti" <pe***@Idontwan tnostinkingemai lfromyou.com> wrote in
message news:10******** *****@corp.supe rnews.com...
"PiGei" <ja************ ***@hotmail.com > wrote in message
news:u9******** ******@TK2MSFTN GP11.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_On End 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.CreateOb ject.

Hope this helps.
Regards,
Peter Foti


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

I'm desperated...

Sub Session_OnEnd

Application.Loc k
Application("co llegati") = Application("co llegati") - 1
Application.UnL ock

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

dbConnstr = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\inetp ub\wwwroot\my.m db"

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***@Idontwan tnostinkingemai lfromyou.com> wrote in
message news:10******** *****@corp.supe rnews.com...
"PiGei" <ja************ ***@hotmail.com > wrote in message
news:u9******** ******@TK2MSFTN GP11.phx.gbl...
I read it, I did all the modification but the code isn't fired

dbConnstr = "Provider=Micro soft.Jet.OLEDB. 4.0;Data
Source=c:\inetp ub\wwwroot\my.m db"

dbConn.Open dbConnstr


In some cases, the OnEnd events run under the context of the
IWAM_machinenam e 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******@NOyah oo.SPAMcom> wrote in message
news:u5******** ******@tk2msftn gp13.phx.gbl...

In some cases, the OnEnd events run under the context of the
IWAM_machinenam e 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
277
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 "&column" it prints out the html as "&amp;column", like I'm trying to write to html. How do I avoid this? Button btn = new System.Web.UI.WebControls.Button(); btn.Text = "Upload";
2
2263
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: ------------------------------------------------------------------------------------ Design mode: <asp:HyperLink ID="MyHyperlink" Runat="server" NavigateUrl="#">Forms</asp:HyperLink>
1
356
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" attributeFormDefault="unqualified"> <xs:element name="Application"> <xs:complexType> <xs:sequence> <xs:element name="ReceivedDate" type="xs:string"/> </xs:sequence>
1
2058
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' function gets called in my global.asax code. --More specifically, it only happens when the page is setting the value of the timeout to a value different than what it currently is.-- Yet, the session remains alive, and any variables stored in the...
2
7145
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 presently ignore exceptions, perhaps we'll start logging something to help us figure this out.) RSWeb.RSWebApp webAppInfo = RSWebApp.GetRSWebApp(Session); webAppInfo.Logout();
2
3898
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 generated and everything works fine. But if the input xml has an &amp; then I am unable to generate a valid output xml file. I have pasted the code below: public class Class1 {
16
5028
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: <%@ Application Codebehind="Global.asax.vb" Inherits="<Namespace>." %> I've done a lot of things I've found on the web to no avial, but here are some unique things about what is happening to me.
12
10659
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 manually log OUT of the site, I have no problem deleting them from the PeopleOnline table. But if they just close the browser, I was assuming I'd have to use the Session_End() event in Global.asax even though I know that this will only occur once the...
0
8009
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8430
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...
1
8078
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
8298
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
5892
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
5452
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();...
0
3962
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2441
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1548
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.