Does ASP.NET transfer ALL session data from SQL server at the start of a request, or only as needed?

StackOverflow https://stackoverflow.com/questions/165399

Question

I'm using ASP.NET, with session state stored out of process in SQL Server. When a page request begins, are the entire contents of a user's session retrieved from the DB, deserialized, and sent to the ASP.NET process in one fell swoop, or are individual objects transferred to the ASP.NET process only as needed?

Basically, I have a page that stores some large objects in session, and it's hard for my application to determine when the data can be disposed. If the data is only pulled out of the DB when it's used then there isn't an issue; if the entire session state is chunked to ASP.NET for each page request, I might have a performance issue.

Was it helpful?

Solution

It's all in one go. The session object is recreated from the store at the beginning of the request. It lets ASP.NET work the same way no matter what the underlying store is.

You can find the gory details here.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top