Where exactly are session variables saved? Cookies? Server memory?
Again where are Application variables saved?
Simple answer is : your session data are stored on the server side. Web browser will get only an string id to identify it's session. In fact, spring security takes more care of session information, because if users even don't login, session may not exist at all.
PHP Default Session Storage (File System): In PHP, by default session data is stored in files on the server. Each file is named after a cookie that is stored on the client computer. This session cookie (PHPSESSID) presumably survives on the client side until all windows of the browser are closed.
To start PHP sessions, you must use the function session_start() . To set session variables, you will need to apply a global PHP $_SESSION variable . Note: The PHP session_start() function has to be the first thing in your document: all HTML tags come after.
A session variable's content is stored on the server, however, the session is identified by a session ID which is stored at the client and sent with each request. Usually the session ID is stored in a cookie, but it can also be appended to URL's.
Variables put into Session are stored wherever the configured SessionStateProvider
is configured to store them.
The default SessionStateProvider
uses what's referred to as In Process (InProc
) Session and the storage location for this is in server memory, inside the memory space of the ASP.NET worker process.
You can configure your own SessionStateProvider
to store Session variables elsewhere, such as out of process, in a database.
Application variables are stored in ApplicationState
which is also stored in the memory space of the ASP.NET worker process. Unlike Session State, Application State applies to all users and sessions. As far as I am aware, There is no configuration to store ApplicationState elsewhere; if you need to store lots of application data then you may want to look at ASP.NET Caching.
Session variables are stored on Server Memory and Disk as Application Variables are.
From ASP.NET documentation:
ASP.NET session state supports several storage options for session variables. Each option is identified as a session-state Mode type. The default behavior is to store session variables in the memory space of the ASP.NET worker process. However, you can also specify that session state should be stored in a separate process, in a SQL Server database, or in a custom data source. If you do not want session state enabled for your application, you can set the session mode to Off.
For an InProc session, variables are stored locally in memory of ASP.NET worker process. Same goes for application state.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With