ASP.NET Session Management Day 28
Stateless Protocols are the type of network protocols in which Client send request to the server and server response back according to current state.
It does not require the server to retain session information or a status about each communicating partner for multiple request.
Stateless Protocol simplify the design of Server.
The stateless protocol requires less resources because system do not need to keep track of the multiple link communications and the session details.
In Stateless Protocol each information packet travel on it’s own without reference to any other packet.
Each communication in Stateless Protocol is discrete and unrelated to those that precedes or follow.
HTTP is called as a stateless protocol because each request is executed independently, without any knowledge of the requests that were executed before it, which means once the transaction ends the connection between the browser and the server is also lost.
In Stateful Protocol If client send a request to the server then it expects some kind of response, if it does not get any response then it resend the request.
Stateful Protocols provide better performance to the client by keeping track of the connection information.
Stateful Application require Backing storage.
Stateful request are always dependent on the server-side state.
TCP session follow stateful protocol because both systems maintain information about the session itself during its life.
In order to make HTTP stateful , we use session management techniques.
So that, it uses the data coming from previous request while processing present request i.e, it uses the same connection for a series of client server interactions.
Cookies are only stored on the client-side machine.
Server script sends a set of cookies to the browser.
When next time browser sends any request to web server then it sends those cookies information to the server and server uses that information to identify the user.
A session creates a file in a temporary directory on the server where registered session variables and their values are stored.
A Aession ends when the user closes the browser or after leaving the site, the server will terminate the session after a predetermined period of time.
To use session in our Application, we need to add this package as a dependency in project.json file.
The next step is to configure session in Startup class.
We need to call "AddSession" method in ConfigureServices method of startup class.
Declaration of this method is not mandatory in startup class. This method is used to Configure services that are used by the application.
When the application is requested for the first time, it calls ConfigureServices method.
Inspect the cookies :
Comments
Post a Comment