Are there limits for session variables in ASP.net?
2 answers
The data in the object is Session
stored in memory on the server. So the storage limit is the memory available to the server. This data is not sent to the client at any stage unless you explicitly do so. Instead, the MVC code sends a cookie to the client's browser as soon as you have assigned any value to the Session object. The value of this cookie is then used to uniquely identify the session.
So...
- The object is
Session
specifically designed so that you can store session data on the server, so this is a good place to put the session-specific data structures as you describe. - Since the object
Session
is only server-side, usingSession
an expensive operation to store the results that is invariant across multiple page updates will speed up page loading because you can use the previous result instead of having to create it again. If you have not exhausted the memory limits on the server, you will not see any performance degradation.
+3
source to share
- If it is an object per session, the session dictionary is a reasonable place to store it.
- If you are using InProcess session store, object size never affects page performance (at least until all the data forces the process to communicate). Other session stores may have little impact depending on how long it takes to move the data, for example. SQL for local process. This will be fast until your subject is really big.
0
source to share