ASP.NET State management is a preserve state control and object in an application because ASP.NET web applications are stateless.
A new instance of the Web page class is created each time the page is posted to the server.
If a user enters information into a web application, that information would be lost in the round trip from the browser.
In a single line, State management maintains and stores the information of any user till the end of the user session.
Two types of state management techniques are available in ASP.NET Server-Side and Client-Side as in the figure:
Hidden field, view state, cookies, control state and query strings are client side;
Session and application are server side state management items.
Session is a very important technique to maintain state.
Session is used to store information and identity.
The server stores information using SessionId.
You can see in the figure an example of creating a sample session:
Sessions are managed by session events.
Session event can be seen in project Global.asax file. Two types of Session Events: session start and session end.
Session_Start: The Session_start event is raised every time a new user requests without a session ID.
Session_End: The Session_End event is raised when session is ended by a user or a time out using Session end method.
The session can storing in InProc Mode, Stateserver Mode, SQL Server Mode, and Custom Mode ways in ASP.NET.
Cookie is a small and an important part of ASP.NET.
Cookie stores user information, session and application.
It can be created constant and temporary and they work with browser request.
Cookies are store on client side. The server can read cookies and abstract data.
Two types of cookies are use: persistance and non-persistence.
Persistence type cookie works with Date and time.
Non-Persistence type cookie is temporary. It is created with access application and discards the close application.
Another server side state manager is Query String
Query string stores the value in URL.
Query string is created with Response.Redirect command.
It is visible to all the users in url as in the figure.
video txt