How is the session object timeout handled in ASP.NET with SQLServer as sessionState mode?

How, maybe, where is the timeout of the session that is processed during the installation of SQL Server as a state handler in an ASP.NET application?

This is a .NET framework that, after loading session objects from the database, decides whether the objects have expired or is it work on the SQL server itself that takes care of this? The reason I suspect (or even considering) the last possibility is because the script that created ASPState mentioned something about the ASPState_Job_DeleteExpiredSessions element.

If so, what is the SQL Server job that cleans up, how often does the job run and how does it align with the timeout parameter in web.config?

+4
source share
2 answers

From an article related to Quantum Elf:

SqlSessionStateStore does not actively track the Expires field. Instead, it relies on an external agent to delete the database and delete expired sessions, whose Expires field contains a date and time less than the current date and time. The ASPState database includes a SQL Server Agent job that periodically (by default, every 60 seconds) calls the DeleteExpiredSessions stored procedure to delete expired sessions.

This means that SQL Server handles the deletion and cleaning of session objects and, in particular, the SQL Job agent.

+6
source

The ASP.NET session state timeout is still configured in the web.config / machine.config file, regardless of whether you execute the state in the process or save it to SQL Server.

0
source

Source: https://habr.com/ru/post/1346753/


All Articles