Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is a Session ID generated on the Server-side or Client-side?

This web page http://www.w3schools.com/ASP/prop_sessionid.asp states that a session ID is generated on the ServerSide.

If this is the case, then how does a server know it's still the same client on the 2nd request response cycle?

Surely the SessionId would be generated on the ClientSide so that the client would be sure of passing the same value to the server?

like image 299
Rory Becker Avatar asked Oct 24 '08 14:10

Rory Becker


People also ask

Where are session IDs generated?

The SessionID value is randomly generated by ASP.NET and stored in a non-expiring session cookie in the browser. The SessionID value is then sent in a cookie with each request to the ASP.NET application.

Are sessions server-side or client-side?

Sessions are server-side files that contain user information, whereas Cookies are client-side files that contain user information. Session is dependent on Cookie, but Cookie is not dependent on a session.

How is a session ID generated?

The session ID is generated using the Random Number Generator (RNG) cryptographic provider. The service provider returns a sequence of 15 randomly generated numbers (15 bytes x 8 bit = 120 bits). The array of random numbers is then mapped to valid URL characters and returned as a string.

Is session is created on server-side?

Sessions are server-side files that store user information. Cookies expire after the user specified lifetime. The session ends when the user closes the browser or logs out of the program.


2 Answers

The SessionID is generated Server Side, but is stored on the Client within a Cookie. Then everytime the client makes a request to the server the SessionID is used to authenticate the existing session for the client.

like image 104
Noah Goodrich Avatar answered Sep 25 '22 17:09

Noah Goodrich


The session ID is normally generated on the server. It's then sent to the client, either as a cookie in the HTTP headers, or by including it in the HTML, i.e. the links become href=my.html?sessionid=1234.

The client's next request will then contain the session Id, either in the cookie or the GET part of the request.

like image 20
Greg Avatar answered Sep 22 '22 17:09

Greg