Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
723 views
in Technique[技术] by (71.8m points)

asp.net - Why Session_End event not raised when StateProvider is not InProc?

I'm asking this question out of curiosity.

I noticed this in my global.asax

void Session_End(object sender, EventArgs e)
{
    // Code that runs when a session ends. 
    // Note: The Session_End event is raised only when the sessionstate mode
    // is set to InProc in the Web.config file. If session mode is set to StateServer 
    // or SQLServer, the event is not raised.
}

I want to understand why Session_End event is not captured/raised when the session mode is StateServer or SQLServer ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

because the ASP.NET Session State it's not in memory anymore...

when using a different process to store the Session State, the IIS does not know (because it is not coupled, the session state is not held by the IIS anymore) when the session ends...

this is specially because the timeouts, I never tried, but does that event fires when you programaticaly call Session.Abandon() ??


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...