asp.net - what are the alternatives of SESSION VARIABLES? -
this question has answer here:
what limitations of session variable in developing large web application. best alternatives of session variables.
please provide me alternatives of session variables
to understand advantages of not using sessions, have understand how sessions work.
in default setup,
- sessions identified cookie set in user's browser ,
- the session data stored in-memory on webserver
when user sends request server, session cookie sent along. contains identifier server uses locate particular user's session data.
you can configure asp.net to
- use query parameters instead of cookies store session identifier
- store session data in database (having central data store session data particularly important if have multiple servers serving site)
now advantages of disabling session state:
- asp.net makes access session data thread-safe serialising requests. means that, when session state enabled, asp.net refuses serve concurrent requests same user. particularly issue when user's browser makes lot of ajax requests. problem can mitigated marking session state read-only requests don't need update it.
- when request comes in, asp.net has fetch session data, , has write data when request ends. may not big issue if session state stored in-memory, if data stored in central database, can cause serious performance problems.
needless say, these issues exacerbated storing large amounts of data large number of users.
for more information see
(that last article bit dated, still read).
alternatives
- if can, avoid session state altogether.
- if absolutely must associate data user, use mechanisms of http , make browser carry data in cookie or perhaps query parameter (this partly whole rest-movement about).
hope helps.
Comments
Post a Comment