Questions tagged [session]

A session refers to the communication between a single client and a server. A session is specific to the user and for each user a new session is created to track all the requests from that user.

From Wikipedia:

A session is a semi-permanent interactive information interchange, also known as a dialogue, a conversation or a meeting, between two or more communicating devices, or between a computer and user (see Login session). A session is set up or established at a certain point in time, and torn down at a later point in time. An established communication session may involve more than one message in each direction. A session is typically, but not always, stateful, meaning that at least one of the communicating parts needs to save information about the session history in order to be able to communicate, as opposed to stateless communication, where the communication consists of independent requests with responses.

An established session is the basic requirement to perform a connection-oriented communication. A session also is the basic step to transmit in connectionless communication modes. However any unidirectional transmission does not define a session.

References:

44567 questions
104
votes
3 answers

How to close a SQLAlchemy session?

Following what we commented in How to close sqlalchemy connection in MySQL, I am checking the connections that SQLAlchemy creates into my database and I cannot manage to close them without exiting from Python. If I run this code in a python console,…
fedorqui
  • 275,237
  • 103
  • 548
  • 598
104
votes
3 answers

Is there an easy way to make sessions timeout in flask?

I'm building a website with flask where users have accounts and are able to login. I'm using flask-principal for the loging in part and the role management. Is there a way of making the user's session expire after say 5 minutes or 10 minutes? I was…
verrochio
  • 1,592
  • 3
  • 13
  • 15
101
votes
10 answers

How to end a session in ExpressJS

I feel like this has to be buried somewhere in the documentation, but I can't find it. How do you close or end or kill (whatever) a session in ExpressJS?
Stephen
  • 7,994
  • 9
  • 44
  • 73
100
votes
7 answers

How to share sessions with Socket.IO 1.x and Express 4.x?

How can I share a session with Socket.io 1.0 and Express 4.x? I use a Redis Store, but I believe it should not matter. I know I have to use a middleware to look at cookies and fetch session, but don't know how. I searched but could not find any…
Mustafa
  • 10,013
  • 10
  • 70
  • 116
100
votes
9 answers

Share session (cookies) between subdomains in Rails?

I have an app setup where each user belongs to a company, and that company has a subdomain (I am using basecamp style subdomains). The problem that I am facing is that rails is creating multiple cookies (one for lvh.me and another for…
Wahaj Ali
  • 4,093
  • 3
  • 23
  • 35
99
votes
11 answers

socket.io and session?

I'm using express framework. I want to reach session data from socket.io. I tried express dynamicHelpers with client.listener.server.dynamicViewHelpers data, but i can't get session data. Is there a simple way to do this? Please see the…
sfs
  • 1,133
  • 2
  • 9
  • 9
98
votes
12 answers

How to delete cookies on an ASP.NET website

In my website when the user clicks on the "Logout" button, the Logout.aspx page loads with code Session.Clear(). In ASP.NET/C#, does this clear all cookies? Or is there any other code that needs to be added to remove all of the cookies of my…
Karthik Malla
  • 5,570
  • 12
  • 46
  • 89
97
votes
1 answer

Sample http range request session

Is it possible to show me a sample http session with range requests. I mean what would be the request and response headers?
chamal
  • 1,103
  • 1
  • 8
  • 6
96
votes
11 answers

PHP sessions that have already been started

In my PHP code, if a session has already started, and I try to start a new one, I get the following Notice: Notice: A session had already been started - ignoring session_start() How can I avoid this?
user1400702
  • 975
  • 1
  • 7
  • 6
96
votes
16 answers

PHP Sessions across sub domains

I am trying to set up the following: auth.example.com sub1.example.com sub2.example.com If the user visits sub1.example.com or sub2.example.com and they are not logged in, they get redirected over to auth.example.com and can log in.…
dragonmantank
  • 15,243
  • 20
  • 84
  • 92
95
votes
6 answers

How can I access session in a webmethod?

Can i use session values inside a WebMethod? I've tried using System.Web.Services.WebMethod(EnableSession = true) but i can't access Session parameter like in this example: [System.Web.Services.WebMethod(EnableSession = true)] …
Sérgio
  • 1,597
  • 2
  • 12
  • 16
95
votes
8 answers

What is the difference between session_unset() and session_destroy() in PHP?

From the php.net documentation: session_destroy — Destroys all data registered to a session session_unset — Free all session variables My three part question is: The two functions seem very similar. What is really the difference between the…
Johan
  • 1,292
  • 1
  • 13
  • 15
94
votes
18 answers

How to access Session variables and set them in javascript?

In code-behind I set Session with some data. Session["usedData"] = "sample data"; And the question is how can I get the Session value(in my example; "sample data") in javascript and set Session["usedData"] with a new value?
Mehmet Ince
  • 4,059
  • 12
  • 45
  • 65
92
votes
8 answers

Location for session files in Apache/PHP

What is the default location of session files on an installation of Apache/PHP on Ubuntu 10.10?
cambraca
  • 27,014
  • 16
  • 68
  • 99
92
votes
10 answers

How unique is the php session id

How unique is the php session id? I got the impression from various things that I've read that I should not rely on two users never getting the same sessionid. Isn't it a GUID?
Jalov
  • 923
  • 1
  • 7
  • 5