Ask a Question related to ASP.NET General, Design and Development.
-
Kenn Ghannon #1
Session_End never fires
I've got an ASP.NET page with a counter subtraction routine in the
Session_End method in the Global.asax.cs:
protected void Session_End(Object sender, EventArgs e)
{
ulong curUsers;
Application.Lock();
curUsers = (ulong)Application["curUsers"];
curUsers--;
Application["iCurUsers"] = curUsers;
Application.UnLock();
}
Basically, this is supposed to keep track of the number of users that are
logged into the system by keeping track of the number of open sessions --
except that the Session_End NEVER fires. I've checked my web.config file
and it does show the mode as InProc:
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>
Is there something else I missed??
Kenn Ghannon Guest
-
OnItemCreated fires twice
All, On the initial load of my grid, the OnItemCreated event fires once. However, when any other grid event fires - sorting, paging - the... -
TextBox init never fires???
Put TextBox on webform. Select Init between it's events and create eventhandler It seems to me that this event has never fired, why? Thanks -
Session lasting too long -- Session_End event firing way late !! ??
Why are my sessions lasting so long? I have them set to 20 minute timeout in config file? The Session_End event is getting called an hour or more... -
session_end and re-login
Dear ASP.NET Programmers, I am using forms authentication in my web application. I would like the users to be transferred to the login page when... -
Session_End Not Firing
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... -
Kevin Spencer #2
Re: Session_End never fires
How do you know for sure that it NEVER fires? The Session_End Event happens
usually some time after the user has closed their browser or navigated
elsewhere. As the server has no idea what is happening on the client, the
Session ends 20 (by default, and according to your web.config file) minutes
after the last Request from that user. So, again, are you sure it is NEVER
firing?
HTH,
Kevin Spencer
Microsoft FrontPage MVP
Internet Developer
[url]http://www.takempis.com[/url]
Some things just happen.
Everything else occurs.
"Kenn Ghannon" <kennyg@ameritech.net> wrote in message
news:yLAOa.6922$Vx2.3202899@newssvr28.news.prodigy .com...> I've got an ASP.NET page with a counter subtraction routine in the
> Session_End method in the Global.asax.cs:
>
> protected void Session_End(Object sender, EventArgs e)
>
> {
>
> ulong curUsers;
>
> Application.Lock();
>
> curUsers = (ulong)Application["curUsers"];
>
> curUsers--;
>
> Application["iCurUsers"] = curUsers;
>
> Application.UnLock();
>
> }
>
> Basically, this is supposed to keep track of the number of users that are
> logged into the system by keeping track of the number of open sessions --
> except that the Session_End NEVER fires. I've checked my web.config file
> and it does show the mode as InProc:
>
> <sessionState
>
> mode="InProc"
>
> stateConnectionString="tcpip=127.0.0.1:42424"
>
> sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
>
> cookieless="false"
>
> timeout="20"
>
> />
>
> Is there something else I missed??
>
>
Kevin Spencer Guest
-
Kenn Ghannon #3
Re: Session_End never fires
I print the value of the curUsers counter (along with another one that is
supposed to keep track of the number of users that have ever visited the
site) on the home page. The values of these two counters are ALWAYS equal
and get reset at the same time (I've had both counters up to over 2000
before the application ended and each counter was reset to 0...because I
have a Application_End() routine that is supposed to save the counter to a
file -- and an accompanying Application_Start() routine to read it in so
that when the application starts again, I can start counting where I left
off -- but never seems to fire either. The counter file is always set to
0).
"Kevin Spencer" <kevin@SPAMMERSSUCKtakempis.com> wrote in message
news:#AmQjBWRDHA.2480@tk2msftngp13.phx.gbl...happens> How do you know for sure that it NEVER fires? The Session_End Eventminutes> usually some time after the user has closed their browser or navigated
> elsewhere. As the server has no idea what is happening on the client, the
> Session ends 20 (by default, and according to your web.config file)are> after the last Request from that user. So, again, are you sure it is NEVER
> firing?
>
> HTH,
>
> Kevin Spencer
> Microsoft FrontPage MVP
> Internet Developer
> [url]http://www.takempis.com[/url]
> Some things just happen.
> Everything else occurs.
>
> "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> news:yLAOa.6922$Vx2.3202899@newssvr28.news.prodigy .com...> > I've got an ASP.NET page with a counter subtraction routine in the
> > Session_End method in the Global.asax.cs:
> >
> > protected void Session_End(Object sender, EventArgs e)
> >
> > {
> >
> > ulong curUsers;
> >
> > Application.Lock();
> >
> > curUsers = (ulong)Application["curUsers"];
> >
> > curUsers--;
> >
> > Application["iCurUsers"] = curUsers;
> >
> > Application.UnLock();
> >
> > }
> >
> > Basically, this is supposed to keep track of the number of users thatsessions --> > logged into the system by keeping track of the number of openfile> > except that the Session_End NEVER fires. I've checked my web.config>> > and it does show the mode as InProc:
> >
> > <sessionState
> >
> > mode="InProc"
> >
> > stateConnectionString="tcpip=127.0.0.1:42424"
> >
> > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> >
> > cookieless="false"
> >
> > timeout="20"
> >
> > />
> >
> > Is there something else I missed??
> >
> >
>
Kenn Ghannon Guest
-
David Waz... #4
Re: Session_End never fires
look for code logic problems, cause it will fire - i promise!
also, you can force the event with SESSION.ABANDON method... and place a
break-point to debug the routine...
"Kenn Ghannon" <kennyg@ameritech.net> wrote in message
news:p5BOa.6931$Vx2.3206330@newssvr28.news.prodigy .com...the> I print the value of the curUsers counter (along with another one that is
> supposed to keep track of the number of users that have ever visited the
> site) on the home page. The values of these two counters are ALWAYS equal
> and get reset at the same time (I've had both counters up to over 2000
> before the application ended and each counter was reset to 0...because I
> have a Application_End() routine that is supposed to save the counter to a
> file -- and an accompanying Application_Start() routine to read it in so
> that when the application starts again, I can start counting where I left
> off -- but never seems to fire either. The counter file is always set to
> 0).
>
>
> "Kevin Spencer" <kevin@SPAMMERSSUCKtakempis.com> wrote in message
> news:#AmQjBWRDHA.2480@tk2msftngp13.phx.gbl...> happens> > How do you know for sure that it NEVER fires? The Session_End Event> > usually some time after the user has closed their browser or navigated
> > elsewhere. As the server has no idea what is happening on the client,NEVER> minutes> > Session ends 20 (by default, and according to your web.config file)> > after the last Request from that user. So, again, are you sure it is> are> > firing?
> >
> > HTH,
> >
> > Kevin Spencer
> > Microsoft FrontPage MVP
> > Internet Developer
> > [url]http://www.takempis.com[/url]
> > Some things just happen.
> > Everything else occurs.
> >
> > "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> > news:yLAOa.6922$Vx2.3202899@newssvr28.news.prodigy .com...> > > I've got an ASP.NET page with a counter subtraction routine in the
> > > Session_End method in the Global.asax.cs:
> > >
> > > protected void Session_End(Object sender, EventArgs e)
> > >
> > > {
> > >
> > > ulong curUsers;
> > >
> > > Application.Lock();
> > >
> > > curUsers = (ulong)Application["curUsers"];
> > >
> > > curUsers--;
> > >
> > > Application["iCurUsers"] = curUsers;
> > >
> > > Application.UnLock();
> > >
> > > }
> > >
> > > Basically, this is supposed to keep track of the number of users that> sessions --> > > logged into the system by keeping track of the number of open> file> > > except that the Session_End NEVER fires. I've checked my web.config>> >> > > and it does show the mode as InProc:
> > >
> > > <sessionState
> > >
> > > mode="InProc"
> > >
> > > stateConnectionString="tcpip=127.0.0.1:42424"
> > >
> > > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> > >
> > > cookieless="false"
> > >
> > > timeout="20"
> > >
> > > />
> > >
> > > Is there something else I missed??
> > >
> > >
> >
>
>
David Waz... Guest
-
Kenn Ghannon #5
Re: Session_End never fires
No real error handling...but I've even gone so far as to put a
Session.Abandon() call in my code-behind file...and it STILL does not end.
Here're the particulars:
From my home.aspx.cs file:
private void Page_Load(object sender, System.EventArgs e)
{
orgLog myLog = (orgLog)Application["orgLog"];
myLog.WriteLine( "Testing" );
Session.Abandon();
}
From my global.asax.cs file:
protected void Session_Start(Object sender, EventArgs e)
{
orgLog LogFile;
Application.Lock();
LogFile = (orgLog)Application["orgLog"];
Application.UnLock();
Session["IPADDR"] = "19.19.19.19"; // just used to store something in the
session
LogFile.WriteLine( ":: Session Begins for " +
Request.ServerVariables["REMOTE_ADDR"].ToString() );
}
protected void Session_End(Object sender, EventArgs e)
{
orgLog LogFile;
Application.Lock();
LogFile = (orgLog)Application["orgLog"];
Application.UnLock();
LogFile.WriteLine( ":: Session Ends for " +
Request.ServerVariables["REMOTE_ADDR"].ToString() );
}
// orgLog is a home made information logging tool (it creates a log file).
I'd think that maybe the problem is here, but I can log to it over and over
without difficulty..
From the Log File:
[7/9/2003 4:10:37 PM] == Application Starts ==
[7/9/2003 4:10:38 PM] :: Session Begins for 127.0.0.1
[7/9/2003 4:10:38 PM] Testing
[7/9/2003 4:25:25 PM] == Application Starts ==
[7/9/2003 4:25:25 PM] :: Session Begins for 127.0.0.1
[7/9/2003 4:25:25 PM] Testing
[7/9/2003 4:30:27 PM] :: Session Begins for 127.0.0.1
[7/9/2003 4:30:27 PM] Testing
[7/9/2003 4:30:28 PM] :: Session Begins for 127.0.0.1
[7/9/2003 4:30:28 PM] Testing
Notice that I'm getting a new Session for each iteration (I'm not sure why)
but I'm never getting a Session_End...
If anyone notices anything out of place, please let me know. I've got my
session timeout set to 1, so I should be getting the session_end after a
minute...but I just seem to be getting a new session without the old session
ever ending...
"Kevin Spencer" <kevin@SPAMMERSSUCKtakempis.com> wrote in message
news:OlV7iaXRDHA.2636@TK2MSFTNGP10.phx.gbl...an> What sort of error-handling are you implementing for this? It sounds likeis> error may be aborting the process somewhere.
>
> HTH,
>
> Kevin Spencer
> Microsoft FrontPage MVP
> Internet Developer
> [url]http://www.takempis.com[/url]
> Some things just happen.
> Everything else occurs.
>
> "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> news:p5BOa.6931$Vx2.3206330@newssvr28.news.prodigy .com...> > I print the value of the curUsers counter (along with another one thatequal> > supposed to keep track of the number of users that have ever visited the
> > site) on the home page. The values of these two counters are ALWAYSa> > and get reset at the same time (I've had both counters up to over 2000
> > before the application ended and each counter was reset to 0...because I
> > have a Application_End() routine that is supposed to save the counter toleft> > file -- and an accompanying Application_Start() routine to read it in so
> > that when the application starts again, I can start counting where Ito> > off -- but never seems to fire either. The counter file is always setthat> the> > 0).
> >
> >
> > "Kevin Spencer" <kevin@SPAMMERSSUCKtakempis.com> wrote in message
> > news:#AmQjBWRDHA.2480@tk2msftngp13.phx.gbl...> > happens> > > How do you know for sure that it NEVER fires? The Session_End Event> > > usually some time after the user has closed their browser or navigated
> > > elsewhere. As the server has no idea what is happening on the client,> NEVER> > minutes> > > Session ends 20 (by default, and according to your web.config file)> > > after the last Request from that user. So, again, are you sure it is> > > firing?
> > >
> > > HTH,
> > >
> > > Kevin Spencer
> > > Microsoft FrontPage MVP
> > > Internet Developer
> > > [url]http://www.takempis.com[/url]
> > > Some things just happen.
> > > Everything else occurs.
> > >
> > > "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> > > news:yLAOa.6922$Vx2.3202899@newssvr28.news.prodigy .com...
> > > > I've got an ASP.NET page with a counter subtraction routine in the
> > > > Session_End method in the Global.asax.cs:
> > > >
> > > > protected void Session_End(Object sender, EventArgs e)
> > > >
> > > > {
> > > >
> > > > ulong curUsers;
> > > >
> > > > Application.Lock();
> > > >
> > > > curUsers = (ulong)Application["curUsers"];
> > > >
> > > > curUsers--;
> > > >
> > > > Application["iCurUsers"] = curUsers;
> > > >
> > > > Application.UnLock();
> > > >
> > > > }
> > > >
> > > > Basically, this is supposed to keep track of the number of users>> > are> > sessions --> > > > logged into the system by keeping track of the number of open> > file> > > > except that the Session_End NEVER fires. I've checked my web.config> >> > > > and it does show the mode as InProc:
> > > >
> > > > <sessionState
> > > >
> > > > mode="InProc"
> > > >
> > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > >
> > > > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> > > >
> > > > cookieless="false"
> > > >
> > > > timeout="20"
> > > >
> > > > />
> > > >
> > > > Is there something else I missed??
> > > >
> > > >
> > >
> > >
> >
>
Kenn Ghannon Guest
-
Kenn Ghannon #6
Re: Session_End never fires
Actually, I DO know why...the added Session.Abandon()...but it still never
goes to Session_End...
"Kenn Ghannon" <kennyg@ameritech.net> wrote in message
news:x__Oa.7206$Vx2.3444725@newssvr28.news.prodigy .com...over> No real error handling...but I've even gone so far as to put a
> Session.Abandon() call in my code-behind file...and it STILL does not end.
> Here're the particulars:
>
> From my home.aspx.cs file:
> private void Page_Load(object sender, System.EventArgs e)
>
> {
>
> orgLog myLog = (orgLog)Application["orgLog"];
>
> myLog.WriteLine( "Testing" );
>
> Session.Abandon();
>
> }
>
> From my global.asax.cs file:
> protected void Session_Start(Object sender, EventArgs e)
>
> {
>
> orgLog LogFile;
>
> Application.Lock();
>
> LogFile = (orgLog)Application["orgLog"];
>
> Application.UnLock();
>
> Session["IPADDR"] = "19.19.19.19"; // just used to store something in the
> session
>
> LogFile.WriteLine( ":: Session Begins for " +
> Request.ServerVariables["REMOTE_ADDR"].ToString() );
>
> }
>
> protected void Session_End(Object sender, EventArgs e)
>
> {
>
> orgLog LogFile;
>
> Application.Lock();
>
> LogFile = (orgLog)Application["orgLog"];
>
> Application.UnLock();
>
> LogFile.WriteLine( ":: Session Ends for " +
> Request.ServerVariables["REMOTE_ADDR"].ToString() );
>
> }
>
> // orgLog is a home made information logging tool (it creates a log file).
> I'd think that maybe the problem is here, but I can log to it over andwhy)> without difficulty..
>
> From the Log File:
>
> [7/9/2003 4:10:37 PM] == Application Starts ==
> [7/9/2003 4:10:38 PM] :: Session Begins for 127.0.0.1
> [7/9/2003 4:10:38 PM] Testing
> [7/9/2003 4:25:25 PM] == Application Starts ==
> [7/9/2003 4:25:25 PM] :: Session Begins for 127.0.0.1
> [7/9/2003 4:25:25 PM] Testing
> [7/9/2003 4:30:27 PM] :: Session Begins for 127.0.0.1
> [7/9/2003 4:30:27 PM] Testing
> [7/9/2003 4:30:28 PM] :: Session Begins for 127.0.0.1
> [7/9/2003 4:30:28 PM] Testing
>
> Notice that I'm getting a new Session for each iteration (I'm not suresession> but I'm never getting a Session_End...
>
> If anyone notices anything out of place, please let me know. I've got my
> session timeout set to 1, so I should be getting the session_end after a
> minute...but I just seem to be getting a new session without the oldlike> ever ending...
>
> "Kevin Spencer" <kevin@SPAMMERSSUCKtakempis.com> wrote in message
> news:OlV7iaXRDHA.2636@TK2MSFTNGP10.phx.gbl...> > What sort of error-handling are you implementing for this? It soundsthe> an> is> > error may be aborting the process somewhere.
> >
> > HTH,
> >
> > Kevin Spencer
> > Microsoft FrontPage MVP
> > Internet Developer
> > [url]http://www.takempis.com[/url]
> > Some things just happen.
> > Everything else occurs.
> >
> > "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> > news:p5BOa.6931$Vx2.3206330@newssvr28.news.prodigy .com...> > > I print the value of the curUsers counter (along with another one that> > > supposed to keep track of the number of users that have ever visitedI> equal> > > site) on the home page. The values of these two counters are ALWAYS> > > and get reset at the same time (I've had both counters up to over 2000
> > > before the application ended and each counter was reset to 0...becauseto> > > have a Application_End() routine that is supposed to save the counterso> a> > > file -- and an accompanying Application_Start() routine to read it innavigated> left> > > that when the application starts again, I can start counting where I> to> > > off -- but never seems to fire either. The counter file is always set> > > 0).
> > >
> > >
> > > "Kevin Spencer" <kevin@SPAMMERSSUCKtakempis.com> wrote in message
> > > news:#AmQjBWRDHA.2480@tk2msftngp13.phx.gbl...
> > > > How do you know for sure that it NEVER fires? The Session_End Event
> > > happens
> > > > usually some time after the user has closed their browser orclient,> > > > elsewhere. As the server has no idea what is happening on theweb.config> that> > the> > NEVER> > > > Session ends 20 (by default, and according to your web.config file)
> > > minutes
> > > > after the last Request from that user. So, again, are you sure it is> > > > firing?
> > > >
> > > > HTH,
> > > >
> > > > Kevin Spencer
> > > > Microsoft FrontPage MVP
> > > > Internet Developer
> > > > [url]http://www.takempis.com[/url]
> > > > Some things just happen.
> > > > Everything else occurs.
> > > >
> > > > "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> > > > news:yLAOa.6922$Vx2.3202899@newssvr28.news.prodigy .com...
> > > > > I've got an ASP.NET page with a counter subtraction routine in the
> > > > > Session_End method in the Global.asax.cs:
> > > > >
> > > > > protected void Session_End(Object sender, EventArgs e)
> > > > >
> > > > > {
> > > > >
> > > > > ulong curUsers;
> > > > >
> > > > > Application.Lock();
> > > > >
> > > > > curUsers = (ulong)Application["curUsers"];
> > > > >
> > > > > curUsers--;
> > > > >
> > > > > Application["iCurUsers"] = curUsers;
> > > > >
> > > > > Application.UnLock();
> > > > >
> > > > > }
> > > > >
> > > > > Basically, this is supposed to keep track of the number of users> > > are
> > > > > logged into the system by keeping track of the number of open
> > > sessions --
> > > > > except that the Session_End NEVER fires. I've checked my>> >> > > file
> > > > > and it does show the mode as InProc:
> > > > >
> > > > > <sessionState
> > > > >
> > > > > mode="InProc"
> > > > >
> > > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > > >
> > > > > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> > > > >
> > > > > cookieless="false"
> > > > >
> > > > > timeout="20"
> > > > >
> > > > > />
> > > > >
> > > > > Is there something else I missed??
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
>
Kenn Ghannon Guest
-
Kevin Spencer #7
Re: Session_End never fires
Of course the Request object is invalid on Session_End! The Session ends
AFTER the last Request has been processed!
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
[url]http://www.takempis.com[/url]
Big things are made up
of lots of little things
"Kenn Ghannon" <kennyg@ameritech.net> wrote in message
news:Wa0Pa.7212$Vx2.3453809@newssvr28.news.prodigy .com...(It> Please excuse me for being a freaking newbie. :) I didn't know that you
> could debug the global.asax.cs file...
>
> Turns out that the Request object is no longer valid during Session_Endobject --> says there's an HTML Exception when doing a 'Watch' of the Requesttimed> but I'm not doing anything weird and I've walked it until the sessionare> out -- and the Request object was valid when the page rendered and wasn't
> when it came back to Session_End...
>
> "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> news:yLAOa.6922$Vx2.3202899@newssvr28.news.prodigy .com...> > I've got an ASP.NET page with a counter subtraction routine in the
> > Session_End method in the Global.asax.cs:
> >
> > protected void Session_End(Object sender, EventArgs e)
> >
> > {
> >
> > ulong curUsers;
> >
> > Application.Lock();
> >
> > curUsers = (ulong)Application["curUsers"];
> >
> > curUsers--;
> >
> > Application["iCurUsers"] = curUsers;
> >
> > Application.UnLock();
> >
> > }
> >
> > Basically, this is supposed to keep track of the number of users thatsessions --> > logged into the system by keeping track of the number of openfile> > except that the Session_End NEVER fires. I've checked my web.config>> > and it does show the mode as InProc:
> >
> > <sessionState
> >
> > mode="InProc"
> >
> > stateConnectionString="tcpip=127.0.0.1:42424"
> >
> > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> >
> > cookieless="false"
> >
> > timeout="20"
> >
> > />
> >
> > Is there something else I missed??
> >
> >
>
Kevin Spencer Guest
-
Kevin Spencer #8
Re: Session_End never fires
BTW, using some try/catch blocks in your code would have helped you debug a
good bit. For example, you could have the app write an Event Log entry with
a Stack Trace and the error details when an error occurs. That way you would
know exactly where any error occurs.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
[url]http://www.takempis.com[/url]
Big things are made up
of lots of little things
"Kenn Ghannon" <kennyg@ameritech.net> wrote in message
news:Wa0Pa.7212$Vx2.3453809@newssvr28.news.prodigy .com...(It> Please excuse me for being a freaking newbie. :) I didn't know that you
> could debug the global.asax.cs file...
>
> Turns out that the Request object is no longer valid during Session_Endobject --> says there's an HTML Exception when doing a 'Watch' of the Requesttimed> but I'm not doing anything weird and I've walked it until the sessionare> out -- and the Request object was valid when the page rendered and wasn't
> when it came back to Session_End...
>
> "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> news:yLAOa.6922$Vx2.3202899@newssvr28.news.prodigy .com...> > I've got an ASP.NET page with a counter subtraction routine in the
> > Session_End method in the Global.asax.cs:
> >
> > protected void Session_End(Object sender, EventArgs e)
> >
> > {
> >
> > ulong curUsers;
> >
> > Application.Lock();
> >
> > curUsers = (ulong)Application["curUsers"];
> >
> > curUsers--;
> >
> > Application["iCurUsers"] = curUsers;
> >
> > Application.UnLock();
> >
> > }
> >
> > Basically, this is supposed to keep track of the number of users thatsessions --> > logged into the system by keeping track of the number of openfile> > except that the Session_End NEVER fires. I've checked my web.config>> > and it does show the mode as InProc:
> >
> > <sessionState
> >
> > mode="InProc"
> >
> > stateConnectionString="tcpip=127.0.0.1:42424"
> >
> > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> >
> > cookieless="false"
> >
> > timeout="20"
> >
> > />
> >
> > Is there something else I missed??
> >
> >
>
Kevin Spencer Guest
-
Kenn Ghannon #9
Re: Session_End never fires
You're right...but my development machine is not going to be where the app
finally resides and I don't have access to the Event log of that server --
so I've been trying to make do without using traces...
"Kevin Spencer" <kevinDIESPAMMERSDIE@takempis.com> wrote in message
news:eWL#kamRDHA.2144@TK2MSFTNGP11.phx.gbl...a> BTW, using some try/catch blocks in your code would have helped you debugwith> good bit. For example, you could have the app write an Event Log entrywould> a Stack Trace and the error details when an error occurs. That way youyou> know exactly where any error occurs.
>
> --
> HTH,
>
> Kevin Spencer
> .Net Developer
> Microsoft MVP
> [url]http://www.takempis.com[/url]
> Big things are made up
> of lots of little things
>
> "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> news:Wa0Pa.7212$Vx2.3453809@newssvr28.news.prodigy .com...> > Please excuse me for being a freaking newbie. :) I didn't know thatwasn't> (It> > could debug the global.asax.cs file...
> >
> > Turns out that the Request object is no longer valid during Session_End> object --> > says there's an HTML Exception when doing a 'Watch' of the Request> timed> > but I'm not doing anything weird and I've walked it until the session> > out -- and the Request object was valid when the page rendered and> are> > when it came back to Session_End...
> >
> > "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> > news:yLAOa.6922$Vx2.3202899@newssvr28.news.prodigy .com...> > > I've got an ASP.NET page with a counter subtraction routine in the
> > > Session_End method in the Global.asax.cs:
> > >
> > > protected void Session_End(Object sender, EventArgs e)
> > >
> > > {
> > >
> > > ulong curUsers;
> > >
> > > Application.Lock();
> > >
> > > curUsers = (ulong)Application["curUsers"];
> > >
> > > curUsers--;
> > >
> > > Application["iCurUsers"] = curUsers;
> > >
> > > Application.UnLock();
> > >
> > > }
> > >
> > > Basically, this is supposed to keep track of the number of users that> sessions --> > > logged into the system by keeping track of the number of open> file> > > except that the Session_End NEVER fires. I've checked my web.config>> >> > > and it does show the mode as InProc:
> > >
> > > <sessionState
> > >
> > > mode="InProc"
> > >
> > > stateConnectionString="tcpip=127.0.0.1:42424"
> > >
> > > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> > >
> > > cookieless="false"
> > >
> > > timeout="20"
> > >
> > > />
> > >
> > > Is there something else I missed??
> > >
> > >
> >
>
Kenn Ghannon Guest
-
Kevin Spencer #10
Re: Session_End never fires
Well, what you can do is write a global Error Handler method that all of
your outermost try/catch blocks use. Then you can change the implementation
of that Error Handler whenever you feel that it is appropriate for the
platform you're running the app on. In any case, it's a good idea to have
some kind of "graceful" error-handling in whatever situation you're in.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
[url]http://www.takempis.com[/url]
Big things are made up
of lots of little things
"Kenn Ghannon" <kennyg@ameritech.net> wrote in message
news:an1Pa.7230$Vx2.3463749@newssvr28.news.prodigy .com...debug> You're right...but my development machine is not going to be where the app
> finally resides and I don't have access to the Event log of that server --
> so I've been trying to make do without using traces...
>
>
> "Kevin Spencer" <kevinDIESPAMMERSDIE@takempis.com> wrote in message
> news:eWL#kamRDHA.2144@TK2MSFTNGP11.phx.gbl...> > BTW, using some try/catch blocks in your code would have helped youSession_End> a> with> > good bit. For example, you could have the app write an Event Log entry> would> > a Stack Trace and the error details when an error occurs. That way you> you> > know exactly where any error occurs.
> >
> > --
> > HTH,
> >
> > Kevin Spencer
> > .Net Developer
> > Microsoft MVP
> > [url]http://www.takempis.com[/url]
> > Big things are made up
> > of lots of little things
> >
> > "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> > news:Wa0Pa.7212$Vx2.3453809@newssvr28.news.prodigy .com...> > > Please excuse me for being a freaking newbie. :) I didn't know that> > > could debug the global.asax.cs file...
> > >
> > > Turns out that the Request object is no longer valid duringthat> wasn't> > (It> > object --> > > says there's an HTML Exception when doing a 'Watch' of the Request> > timed> > > but I'm not doing anything weird and I've walked it until the session> > > out -- and the Request object was valid when the page rendered and> > > when it came back to Session_End...
> > >
> > > "Kenn Ghannon" <kennyg@ameritech.net> wrote in message
> > > news:yLAOa.6922$Vx2.3202899@newssvr28.news.prodigy .com...
> > > > I've got an ASP.NET page with a counter subtraction routine in the
> > > > Session_End method in the Global.asax.cs:
> > > >
> > > > protected void Session_End(Object sender, EventArgs e)
> > > >
> > > > {
> > > >
> > > > ulong curUsers;
> > > >
> > > > Application.Lock();
> > > >
> > > > curUsers = (ulong)Application["curUsers"];
> > > >
> > > > curUsers--;
> > > >
> > > > Application["iCurUsers"] = curUsers;
> > > >
> > > > Application.UnLock();
> > > >
> > > > }
> > > >
> > > > Basically, this is supposed to keep track of the number of users>> > are> > sessions --> > > > logged into the system by keeping track of the number of open> > file> > > > except that the Session_End NEVER fires. I've checked my web.config> >> > > > and it does show the mode as InProc:
> > > >
> > > > <sessionState
> > > >
> > > > mode="InProc"
> > > >
> > > > stateConnectionString="tcpip=127.0.0.1:42424"
> > > >
> > > > sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
> > > >
> > > > cookieless="false"
> > > >
> > > > timeout="20"
> > > >
> > > > />
> > > >
> > > > Is there something else I missed??
> > > >
> > > >
> > >
> > >
> >
>
Kevin Spencer Guest



Reply With Quote

