473,324 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Problem with Session_End in Global.asax

Hello

I was wondering if someone could help me out with a Session_End problem in my Global.asax. I've tried everything, and still no success
Here is the scenario: sessionstate is set to InProc. I have timeout set to 1 min
I have a variable in session_start that is incremented each new session, and it is then decremented in Session_End. I use this variable on a web form to show current users online. All of this works just fine, so I know that session_end event handler is firing
I also have the following in the Application_AuthenticateRequest handler:(This is an instance method that performs an update stored procedure in Sql Server 2000, and it also works fine
Activity myActivity = new Activity( )
myActivity.Method(User.Identity.Name.ToString( ), true)

Here's the prob: Session_end also contains this
Activity myActivity = new Activity( )
myActivity.Method(User.Identity.Name.ToString( ), false)

when the session timeout occurs after 1 min, this procedure does not work. What am I doing wrong? Please help. The decrementing of the variable works in session_end, why won't this
Thank you in advance for any help on this subject.
Nov 18 '05 #1
2 4699
I created a quick test app to see if I could repro your problem, and I did.
I think I figured out why it is failing as well.
When I went debugging through the code and set a breakpoint in the
Session_End event and tried to access User.Identity, an exception was
thrown. You don't see this exception because it is apparently squished and
ignored by ASP.Net.

From what I can gather, in the Session_End event the login information has
already been lost and therefore User.Identidy fails. I am going to assume
that the counter that you decrement is before the code that accesses
User.Identity. That code will get executed which is why the counter is
working, but because User.Identity fails, your call to
myActivity.Method(...) fails.

HTH,
-Cliff

"Bela" <an*******@discussions.microsoft.com> wrote in message
news:52**********************************@microsof t.com...
Hello,

I was wondering if someone could help me out with a Session_End problem in my Global.asax. I've tried everything, and still no success! Here is the scenario: sessionstate is set to InProc. I have timeout set to 1 min. I have a variable in session_start that is incremented each new session, and it is then decremented in Session_End. I use this variable on a web
form to show current users online. All of this works just fine, so I know
that session_end event handler is firing. I also have the following in the Application_AuthenticateRequest handler:(This is an instance method that performs an update stored procedure
in Sql Server 2000, and it also works fine) Activity myActivity = new Activity( );
myActivity.Method(User.Identity.Name.ToString( ), true);

Here's the prob: Session_end also contains this:
Activity myActivity = new Activity( );
myActivity.Method(User.Identity.Name.ToString( ), false);

when the session timeout occurs after 1 min, this procedure does not work. What am I doing wrong? Please help. The decrementing of the variable works
in session_end, why won't this? Thank you in advance for any help on this subject.

Nov 18 '05 #2
i think you should debug you function
myActivity.Method(User.Identity.Name.ToString( ), false);

just writing some trace to check why the function do not work...

"Bela" <an*******@discussions.microsoft.com> дÈëÏûÏ¢
news:52**********************************@microsof t.com...
Hello,

I was wondering if someone could help me out with a Session_End problem in my Global.asax. I've tried everything, and still no success! Here is the scenario: sessionstate is set to InProc. I have timeout set to 1 min. I have a variable in session_start that is incremented each new session, and it is then decremented in Session_End. I use this variable on a web
form to show current users online. All of this works just fine, so I know
that session_end event handler is firing. I also have the following in the Application_AuthenticateRequest handler:(This is an instance method that performs an update stored procedure
in Sql Server 2000, and it also works fine) Activity myActivity = new Activity( );
myActivity.Method(User.Identity.Name.ToString( ), true);

Here's the prob: Session_end also contains this:
Activity myActivity = new Activity( );
myActivity.Method(User.Identity.Name.ToString( ), false);

when the session timeout occurs after 1 min, this procedure does not work. What am I doing wrong? Please help. The decrementing of the variable works
in session_end, why won't this? Thank you in advance for any help on this subject.

Nov 18 '05 #3

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

Similar topics

0
by: Yoshitha | last post by:
Hi I have a problem with global.asax.vb file Application_Start, Session_Start are firing well But Sessio_End event is not going to be fired when I close the browser(Session) What could be...
4
by: Kim Bach Petersen | last post by:
I would like to record user behavior data stored in session variables. Since the data is modified throughout each session it seemed obvious to store the data when the session terminates - using...
3
by: Juan Carlos | last post by:
Hi, I developer an ASP.NET web application that use an COM object. In global.asax put <object id="myCom" runat="server" classid="COMClass" scope="session"/> It's ok, no?? (little question,...
1
by: Yoshitha | last post by:
Hi I have a problem with global.asax.vb file Application_Start, Session_Start are firing well But Sessio_End event is not going to be fired when I close the browser(Session) What could be...
4
by: Manny Chohan | last post by:
Hi Guys, I maintain login info for users in table such as who, when and sessionId. When they click log off, i note the time in table. Some of these users just close the window therefore i end...
1
by: R.A.M. | last post by:
Hello, Could you help me please with a problem of Global.asax implementation? I have little experience. I have written Global.asax for my ASP.NET application: <%@ Application Language="C#" %>...
11
by: Ron | last post by:
I have a web project compiled with the new "Web Deployment Projects" plugin for VS2005. I'm deploying the web project to one assembly and with updateable option set to ON. When I'm running the...
3
by: Jack | last post by:
Hello, I am trying to add how many users online to my website. I have setup a Global.asax and need some morehelp. I have the following Global.asax Public Class Global Inherits...
1
by: filmar | last post by:
Hi guys! I need some help. I have 2 IISes and the same project in asp.net 1.1. In the 1st IIS project works but in the 2nd doesn`t. In global.asax i have this sub: Sub Session_OnStart()...
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.