What are session and session variables?

Can you tell me what session and session variables are? I do not need to compare an ASP session and an ASP.NET session because I know nothing about ASP.

I have seen many articles about session types. But still, I cannot correctly understand what a session is and what session variables in ASP.NET?

+4
source share
5 answers

Session - track each user request. Therefore, every time a web page is sent back, the asp.net runtime knows which user is receiving the request. Now, since HTTP is a stateless protocol, that is, each request from the same user is like a new request to it. Thus, to maintain a session, Asp.Net has session variables.

Session variables. Session variables are server-side supported variables at asp.net runtime. Each user is identified by a unique SessioID. This session is stored in a cookie (if the browser supports cookies) on the client side after the user's first request. when a client sends back the page, this cookie is available in the request header. So, now the server knows that this user request comes from which user. In addition, you can also store user information in session variables, which will be available on the server side.

+15
source

From here

ASP.NET session state allows you to store and retrieve values ​​for a user when a user moves ASP.NET pages in a web application.

HTTP is a stateless protocol. This means that the web server processes each HTTP request for the page as an independent request. The server does not know the values ​​of the variables that were used during previous queries. Session State ASP.NET identifies requests from the same browser for a limited time in the form of a session and provides the ability to store variable values ​​throughout the session.

By default, ASP.NET session state is enabled for all ASP.NET applications.

Session Variables :

Session variables are stored in the SessionStateItemCollection object, which is displayed through the HttpContext.Session property. On an ASP.NET page, the current session variables are displayed through the Session property of the page object.

+4
source

Read this article, Web Server Session Management on Wikipedia:

http://en.wikipedia.org/wiki/Session_management#Web_server_session_management

Hope this helps.

Yang

+2
source

Sessions store user information on the server side, like uid and pass. A session is a server-side state management method. The first time you log in, you are often assigned a unique session identifier, which is stored in a cookie (if cookies are supported), which, in turn, is transmitted to the server with each request so that it can receive your session.

-2
source

Source: https://habr.com/ru/post/1307507/


All Articles