Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is session and session variables?

Can you please guide me what is session and session variables? I don't need a comparison of ASP session and ASP.NET session because I don't know anything about ASP.

I have seen many articles on types of session as well. But still I can't understand correctly what is session and what are session variables in ASP.NET?

like image 850
haansi Avatar asked Apr 21 '10 05:04

haansi


1 Answers

Session - Is to keep track of each user's request. So each time the web page is posted back asp.net runtime knows from which user the request is coming from. Now since HTTP is a stateless protocol, meaning each request from the same user is like a new request to it. So, to maintain a session Asp.Net has Session variables.

Session Variables- The session variables are variables maintained on server side by asp.net runtime. Each user is identified by a a unique number called SessioID. This session is stored in a cookie (if browser supports cookie) on client side after the first user request. when the client posts back a page , this cookie is available in the request header. So now server knows that this user request is coming from which user. Besides this you can also store user specific information in session variables, which will be availale on server side.

like image 136
Rasshme Chawla Avatar answered Sep 23 '22 13:09

Rasshme Chawla