Reputation: 23
What is the best way to approach to ASP.NET session management, when I keep in mind I have a huge object instance to keep in session, also this should be database managed i.e. the session id is kept in database.
Also the object instance that I keep in session has data table instances within.
Thanks in advance for any suggestions/ comments.
Upvotes: 0
Views: 189
Reputation: 240
'Best way' would be removing huge objects from session storage. Data table instance in session storage is a total 'never use session like this' example.
ASP.NET session is a InProc collection (by default). It saves in current process memory all the data you place to 'Session' collection. So if apppool flushes - you loose session.
Every single type of 'session provider' you can try to use would require serializing the data placed in session. This means HUGE problems for your data tables.
Upvotes: 0
Reputation: 4998
ASP.NET has few session state providers, one is SqlSessionStateStore
which stores session state in the SQL server.
You can read more on MSDN.
Another thing is that storing huge objects in a session(especially DataTables) seems like a bad idea. One thing is that you can hit memory issues with date, locks and data going out of sync, another is that retrieving, serializing and deserializing it can be both time and resources consuming.
Upvotes: 1