473,385 Members | 1,772 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,385 software developers and data experts.

Session_End Event

T.
Does the Session_End event actually fire? I am building an ASP.NET
application, and so far I have an HTML page and a single asp page. The HTML
is the home page. I have code in the Global.asax file's Session_End handler
that closes the session's connections to the SQL backend. The thing never
fires! After my app closes, I run sp_who in Query Analyzer to see connections
to the database. Low and behold my ASP connections are still there!
What could I be doing wrong?

Thanks in advance
Nov 19 '05 #1
7 1732
> What could I be doing wrong?

You shouldn't be storing connection/commands/readers in Session. The best
model is to open the connection late and release the connection early.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #2
T.
I will try that. Thanks!

"Brock Allen" wrote:
What could I be doing wrong?


You shouldn't be storing connection/commands/readers in Session. The best
model is to open the connection late and release the connection early.

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #3
> You shouldn't be storing connection/commands/readers in Session. The
best model is to open the connection late and release the connection
early.


Er, and when I say this I mean open the connection when you need it... do
all your dataaccess... then close it ASAP in the same method. I wasn't sure
if that implication got across... :)

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #4
T.
Oh yes I understood quite well what you mean.

On the other I take it though to mean that the Session_End event cann't
really be relied upon!

Thanks

"Brock Allen" wrote:
You shouldn't be storing connection/commands/readers in Session. The
best model is to open the connection late and release the connection
early.


Er, and when I say this I mean open the connection when you need it... do
all your dataaccess... then close it ASAP in the same method. I wasn't sure
if that implication got across... :)

-Brock
DevelopMentor
http://staff.develop.com/ballen

Nov 19 '05 #5
> On the other I take it though to mean that the Session_End event
cann't really be relied upon!


It certainly is not called if you're using the NT State Service or SqlServer.
It should be called if stored InProc (but not sure why it's not in your scenario).

In general I recommend to not use session state. For small, quick and dirty
apps, then perhaps. But for large apps, I think it's a mistake. There are
other ways of doing things.

-Brock
DevelopMentor
http://staff.develop.com/ballen


Nov 19 '05 #6
session timeout, usually after 20 minutes. if you wait long enough and are
using inproc sessions, it should fire.

-- bruce (sqlwork.com)

"T." <T@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
Does the Session_End event actually fire? I am building an ASP.NET
application, and so far I have an HTML page and a single asp page. The
HTML
is the home page. I have code in the Global.asax file's Session_End
handler
that closes the session's connections to the SQL backend. The thing never
fires! After my app closes, I run sp_who in Query Analyzer to see
connections
to the database. Low and behold my ASP connections are still there!
What could I be doing wrong?

Thanks in advance

Nov 19 '05 #7
I am writing an application in ASP.Net Version 1.1. I am using InProc mode.
I am trying to capture the time that Session Timeout occurs. However, I have
never been able to get the Session_End event to fire. I that maybe the
database code was too complex to complete before session timeout finished so
I simplified the code to a simple write to a text file. This still does not
run. I inserted a break point into the event code, changed the session
timeout time to five minutes and sat waited for the code to run and stop at
the break point. Nothihng. All the discussions and documentation I've read
has stated that the session end event is supposed to fire at Session timeout
when state mode is set to inproc. I do not know why this is happening.
ERJ MCSD MCDBA

"Bruce Barker" wrote:
session timeout, usually after 20 minutes. if you wait long enough and are
using inproc sessions, it should fire.

-- bruce (sqlwork.com)

"T." <T@discussions.microsoft.com> wrote in message
news:59**********************************@microsof t.com...
Does the Session_End event actually fire? I am building an ASP.NET
application, and so far I have an HTML page and a single asp page. The
HTML
is the home page. I have code in the Global.asax file's Session_End
handler
that closes the session's connections to the SQL backend. The thing never
fires! After my app closes, I run sp_who in Query Analyzer to see
connections
to the database. Low and behold my ASP connections are still there!
What could I be doing wrong?

Thanks in advance


Nov 19 '05 #8

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

Similar topics

1
by: raj | last post by:
Hi, I am facing a problem of automatic session timeout problem and automatic session_end event fired. Case1: As I have analyzed I get to know that the default session timeout is 20 in...
2
by: Chris Sibel | last post by:
Hey guys I have a user tracking setup to track users. What it does is once a user hits my site it sends me an email telling me some info and once a user clicks the logout button it sends a second...
2
by: Bela | last post by:
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....
5
by: Ron Vecchi | last post by:
1.) If I want to use an object that was stored in the Application state will it be avilable in the Session_End event. (even on the last session to end)?? 2.) Can I use the current sessions state in...
11
by: OldProgrammer | last post by:
All the documentation and discussion I have read indicate that the Session_End is not supposed to fire unless you are in "inProc" Session state mode, and then only on Session Timeout or at Session...
14
by: Bruno | last post by:
We are attempting to automatically log users off from the Session_End event in global.asax. It is not a critical task, more of a housekeeping task so that we know if users have closed down their...
8
by: Roger | last post by:
When I call the session.abandon() method, it calls the session_end event. When a user closes the browser or clicks the log off button, I can dispose of objects and abandon the session cleaning....
1
by: =?Utf-8?B?YnJlbnQ5NjA=?= | last post by:
Environment: ASP.NET 2.0, SQL Server 2005, C#, Visual Studio 2005 In my Session_End event, I am executing a stored procedure to update a database table that is used to log user sessions. When...
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: anithaapr05 | last post by:
After the session end i try to write the session value.In this, it write the session value after the session end, but i got the warning in application event. My asp code: void...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.