Session variable is a unit of information within a session state. It is maintained across a user's visit within the constraints of the stateless HTTP protocol.
Questions tagged [session-variables]
3857 questions
1250
votes
8 answers
How do servlets work? Instantiation, sessions, shared variables and multithreading
Suppose, I have a webserver which holds numerous servlets. For information passing among those servlets I am setting session and instance variables.
Now, if 2 or more users send request to this server then what happens to the session variables?
Will…

Ku Jon
- 12,503
- 3
- 16
- 4
517
votes
28 answers
Check if PHP session has already started
I have a PHP file that is sometimes called from a page that has started a session and sometimes from a page that doesn't have session started. Therefore when I have session_start() on this script I sometimes get the error message for "session…

Logan
- 10,649
- 13
- 41
- 54
179
votes
16 answers
How to use Local storage in Angular
I need to store data in the browser's session and retrieve the data until the session exits. How do you use local and session storage in Angular 2?

Jaya Kumar B A
- 1,807
- 2
- 9
- 3
170
votes
10 answers
Session variables in ASP.NET MVC
I am writing a web application that will allow a user to browse to multiple web pages within the website making certain requests. All information that the user inputs will be stored in an object that I created. The problem is that I need this object…

Draco
- 16,156
- 23
- 77
- 92
167
votes
7 answers
How to access session variables from any class in ASP.NET?
I have created a class file in the App_Code folder in my application. I have a session variable
Session["loginId"]
I want to access this session variables in my class, but when I am writing the following line then it gives…

djmzfKnm
- 26,679
- 70
- 166
- 227
146
votes
5 answers
How to empty/destroy a session in rails?
I can't seem to find it anywhere... How do I delete/destroy/reset/empty/clear a user's session in Rails? Not just one value but the whole thing..

tybro0103
- 48,327
- 33
- 144
- 170
123
votes
5 answers
How to use sessions in an ASP.NET MVC 4 application?
I am new to ASP.NET MVC. I have used PHP before and it was easy to create a session and select user records based on the current session variables.
I have looked everywhere on the Internet for a simple step-by-step tutorial that can show me how to…

Thuto Paul Gaotingwe
- 1,425
- 4
- 15
- 15
72
votes
3 answers
MySQL wait_timeout Variable - GLOBAL vs SESSION
SHOW VARIABLES LIKE "%wait%"
Result: 28800
SET @@GLOBAL.wait_timeout=300
SHOW GLOBAL VARIABLES LIKE "%wait%"
Result: 300
SHOW SESSION VARIABLES LIKE "%wait%"
Result:28800
I am confused by the results. Why does the last query give Result:28800…

Arunjith
- 955
- 3
- 8
- 12
67
votes
4 answers
How can I get the value of a session variable inside a static method?
I am using ASP.NET page methods with jQuery.... How do I get the value of a session variable inside a static method in C#?
protected void Page_Load(object sender, EventArgs e)
{
Session["UserName"] = "Pandiya";
}
[WebMethod]
public static…

ACP
- 34,682
- 100
- 231
- 371
64
votes
12 answers
When should I use session variables instead of cookies?
Session variables and cookies seem very similar to me. I understand the technical differences, but how do you decide when to use one vs. the other?

sprugman
- 19,351
- 35
- 110
- 163
62
votes
7 answers
How to configure a session timeout for Grails application?
In one of controllers in my Grails application I'm preserving a parameter value in a session variable like this:
session.myVariable = params.myValue
After that, I can access the saved value from different controllers/GSP-pages as long as I actively…

curd0
- 2,300
- 3
- 27
- 32
56
votes
5 answers
ASP.NET removing an item from Session?
Which method is preferred?
Session.Remove("foo");
Session["foo"] = null;
Is there a difference?

David Basarab
- 72,212
- 42
- 129
- 156
56
votes
3 answers
Is there a best practice and recommended alternative to Session variables in MVC
Okay, so first off before anyone attempts to make a determination that this is a "duplicate" question; I have reviewed most of the posts on SO regarding similar questions but even in combination of all that has been said I still am somewhat at a…

Mark
- 1,667
- 2
- 24
- 51
55
votes
4 answers
Are there limits for session variables?
As the title says, are there limits (if any) for session variables or they're considered as usual variables and can store equal amount of data?
I'm looking if there are any other limits aside from variable type ones like max length, max values and…

tomsseisums
- 13,168
- 19
- 83
- 145
50
votes
10 answers
Set session variable in laravel
I would like to set a variable in the session using laravel this way
Session::set('variableName')=$value;
but the problem is that I don't know where to put this code, 'cause I would like to set it for one time (when the guest visite the home page…

user3429578
- 1,093
- 3
- 12
- 21