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
1167
votes
17 answers

How do I expire a PHP session after 30 minutes?

I need to keep a session alive for 30 minutes and then destroy it.
Tom
  • 33,626
  • 31
  • 85
  • 109
630
votes
33 answers

Invalidating JSON Web Tokens

For a new node.js project I'm working on, I'm thinking about switching over from a cookie based session approach (by this, I mean, storing an id to a key-value store containing user sessions in a user's browser) to a token-based session approach (no…
funseiki
  • 9,167
  • 9
  • 36
  • 59
557
votes
9 answers

Do sessions really violate RESTfulness?

Is using sessions in a RESTful API really violating RESTfulness? I have seen many opinions going either direction, but I'm not convinced that sessions are RESTless. From my point of view: authentication is not prohibited for RESTfulness (otherwise…
deceze
  • 510,633
  • 85
  • 743
  • 889
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
427
votes
6 answers

What are sessions? How do they work?

I am just beginning to start learning web application development, using python. I am coming across the terms 'cookies' and 'sessions'. I understand cookies in that they store some info in a key value pair on the browser. But I have a little…
Rasmus
  • 8,248
  • 12
  • 48
  • 72
419
votes
10 answers

How to use cURL to send Cookies?

I read that sending cookies with cURL works, but not for me. I have a REST endpoint like this: class LoginResource(restful.Resource): def get(self): print(session) if 'USER_TOKEN' in session: return 'OK' …
daydreamer
  • 87,243
  • 191
  • 450
  • 722
414
votes
14 answers

How to save and restore multiple different sessions in Vim?

Depending on my task in Vim I have several tabs open. How can I save different sessions for later use?
Jogusa
  • 5,530
  • 5
  • 24
  • 23
379
votes
12 answers

Why is jQuery's .ajax() method not sending my session cookie?

After logging in via $.ajax() to a site, I am trying to send a second $.ajax() request to that site - but when I check the headers sent using FireBug, there is no session cookie being included in the request. What am I doing wrong?
user345625
  • 3,911
  • 3
  • 16
  • 6
308
votes
2 answers

Sticky and NON-Sticky sessions

I want to know the difference between sticky- and non-sticky sessions. What I understood after reading from internet: Sticky : only single session object will be there. Non-sticky session : session object for each server node
Sunny Gupta
  • 6,929
  • 15
  • 52
  • 80
304
votes
12 answers

"Keep Me Logged In" - the best approach

My web application uses sessions to store information about the user once they've logged in, and to maintain that information as they travel from page to page within the app. In this specific application, I'm storing the user_id, first_name and…
Matthew
  • 7,605
  • 7
  • 39
  • 39
300
votes
12 answers

Session lock causes ASP.Net websites to be slow

I just discovered that every request in an ASP.Net web application gets a Session lock at the beginning of a request, and then releases it at the end of the request! In case the implications of this are lost on you, as it was for me at first, this…
James
  • 7,877
  • 7
  • 42
  • 57
295
votes
7 answers

Authentication: JWT usage vs session

What is the advantage of using JWTs over sessions in situations like authentication? Is it used as a standalone approach or is it used in the session?
Pourya8366
  • 3,424
  • 4
  • 21
  • 28
279
votes
24 answers

How to fix org.hibernate.LazyInitializationException - could not initialize proxy - no Session

I get the following exception: Exception in thread "main" org.hibernate.LazyInitializationException: could not initialize proxy - no Session at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:167) at…
Blerta Dhimitri
  • 3,253
  • 5
  • 22
  • 33
266
votes
3 answers

SQLAlchemy: engine, connection and session difference

I use SQLAlchemy and there are at least three entities: engine, session and connection, which have execute method, so if I e.g. want to select all records from table I can do this engine.execute(select([table])).fetchall() and…
ololobus
  • 3,568
  • 2
  • 18
  • 23
236
votes
15 answers

Cookies vs. sessions in PHP

I started using PHP a couple of months ago. For the sake of creating a login system for my website, I read about cookies and sessions and their differences (cookies are stored in the user's browser and sessions on the server). At that time, I…
Nadjib Mami
  • 5,736
  • 9
  • 37
  • 49
1
2 3
99 100