Questions tagged [session-variables]

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.

3857 questions
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
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…
  • 10,649
  • 13
  • 41
  • 54
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
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…
  • 16,156
  • 23
  • 77
  • 92
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…
  • 26,679
  • 70
  • 166
  • 227
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..
  • 48,327
  • 33
  • 144
  • 170
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…
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…
  • 955
  • 3
  • 8
  • 12
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…
  • 34,682
  • 100
  • 231
  • 371
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?
  • 19,351
  • 35
  • 110
  • 163
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…
  • 2,300
  • 3
  • 27
  • 32
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
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…
  • 1,667
  • 2
  • 24
  • 51
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…
  • 13,168
  • 19
  • 83
  • 145
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…
2 3
99 100