Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which one is responsible for the generation of http session ID? The client browser, the server, or both?

Tags:

java

session

web

I am working on a Java web application which involves allocating server resources on a per http session basis. So the http session ID would become part of the key of a database table, and its uniqueness in the table is a must. The description of the Java HttpSession.getID() method claimed that this ID is unique, so the server side should have someway to enforce such nature. But on the client browser, HTTP session is usually shared by multiple browsing windows unless explicitly request a new session to be to used. This suggests that the browser have active control over session usage as well. So which side is responsible for the generation of HTTP session ID? Or it is a combined effort of both sides? Is there any chance that the same session ID is generated accidentally by browsers on different computers accessing the same website?

like image 405
God_of_Thunder Avatar asked Jan 25 '26 00:01

God_of_Thunder


1 Answers

Session id is generated by server and is usually granted to a visitor on his/her first visit to a site.

A session ID is a unique number that a Web site's server assigns a specific user for the duration of that user's visit (session). The session ID can be stored as a cookie, form field, or URL (Uniform Resource Locator). Some Web servers generate session IDs by simply incrementing static numbers. However, most servers use algorithms that involve more complex methods, such as factoring in the date and time of the visit along with other variables defined by the server administrator.

like image 151
sol4me Avatar answered Jan 26 '26 17:01

sol4me



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!