I'm developing my web application using MVC 4, I need to send an email to the user after session time out or after session has been ended by the user. Anyone have any idea how to detect the session end? Thanks
Asked
Active
Viewed 5,454 times
2
-
which sessionstate mode are you using ? – Frebin Francis Feb 11 '15 at 09:00
-
@frebinfrancis I'm using InProc mode – Maher Odeh Feb 11 '15 at 09:10
1 Answers
1
You can use Session_End Event in Global.asax File
protected void Session_End(object sender, EventArgs e)
{
// Write your Logic
}
Be patient. The event should be called, but not necessarily right after the timeout.
You could try from a Browser: Start a session,wait > 1 minute, do a Postback somehow
This should help to verify that the Timeout works and I think you will also see the SessionEnd happening at that time. Otherwise, just wait and start some other sessions. The system will come around o calling it sometime.
About Session_End Event in MSDN blog
Hope this helps

Community
- 1
- 1

Frebin Francis
- 1,905
- 1
- 11
- 19
-
As far as I know, Session_End does not worked when the user close the browser, It's just working on case of timeout. – Maher Odeh Feb 11 '15 at 09:22
-
-
you can refer this question for more details http://stackoverflow.com/questions/28219970/img-requests-before-windows-close/28403618#28403618 – Frebin Francis Feb 11 '15 at 09:26