sly_Chandan
sly_Chandan

Reputation: 3515

Asp.net session storage

Are there any pre-conditions before storing any objects in session state. I mean when will I not be able to insert an object in session state. This was an interview question that was asked to me. What could be the possible reason for not being able to store an object in session state?

Upvotes: 9

Views: 2547

Answers (2)

Peter Short
Peter Short

Reputation: 772

There are places in the asp.net page request life-cycle that you do not have access to the session state yet due to the lack of a valid user session such as Application_Authorize where we do not have an authenticated user yet, so Session will be null. The actual implementation of the Session store shouldn't really be a concern, neither should how the data is serialized.

Upvotes: 3

Safran Ali
Safran Ali

Reputation: 4497

Here are some that should be considered:

  • If it has more session data, then more memory is consumed on the web server, and that can affect performance.

  • It won't work in web garden mode, because in that mode multiple aspnet_wp.exe will be running on the same machine.

  • And if the appdomain or worker process (aspnet_wp.exe) restart/recycles very often then its not a good idea to use it

and it is gathered from here ... hope it answer your query ...

Upvotes: 4

Related Questions