Last post Aug 23, 2015 01:42 PM by bruce (sqlwork.com)
Jul 15, 2015 09:39 PM|pavanlalit|LINK
In my ASP.NET Application, the Session_End method is firing when Application starts up. My break points in that method hits when app starts for the first time. Isn't it supposed to execute only after Session was timed out? why is this weird behavior.
Am i missing something.
My WebConfig is set to have timeout as 20 mins and its by default Inproc.
Jul 15, 2015 10:56 PM|markfitzme|LINK
Sessions can also terminate when the application recycles.
Jul 16, 2015 05:19 PM|pavanlalit|LINK
But, when App Starts, it means recycling?
Am I recycling the App pool when I press ctrl+F5 on my machine to run the code of the App? What do you mean by app recycling. Can you pls illustrate for me.
Jul 19, 2015 10:01 PM|Weibo Zhang|LINK
Session End can be called when you use Session.Abandon(). You could step by step to debug when you call the abandon. The following is about firing the Session_End event conditions, you could take a look.
1.The Session_End event only will be fired when the the mode is InProc；
<sessionState mode="InProc" cookieless="false" timeout="20"/>
2.There must be something saved in the session；
3.Session timed out or execute Session.Abandon ().
I hope it’s useful to you.
Jul 21, 2015 02:11 PM|PatriceSc|LINK
Would have to check but could it be that nothing yet is stored in the session? In this case it always starts (but don't remember if session_end is called as well).
Aug 06, 2015 07:59 AM|sirdneo|LINK
Session_Start is supposed to be called after Application_Start. But if Session_END is being called it means that you have called session.abandon somewhere in your code.
Aug 23, 2015 01:42 PM|bruce (sqlwork.com)|LINK
on a recycle, session_end is called for all sessions created in the old app domain. generally this will called after the new app domain is setup. so if you trace you will see the new app domain, app start, session start, then shutdown of the old domain -
session end, application end. note, the session end is for the old domain, using old objects.
note: a recycle is called when the app domain times out, or too many recompiles of the source files have happened (controlled by web.config settings)