I
I
Ivanushka2552021-11-23 01:35:09
Browsers
Ivanushka255, 2021-11-23 01:35:09

Why does one resource use multiple cookies?

I was interested in looking at cookies in the browser itself. It turned out that one site can use several cookies.
619c1afd04b7b082790935.jpeg
Question: why multiple? Wikipedia describes the mechanics of how cookie transfer works:

  • The server receives the username and password, checks them and, if they are correct, sends a successful login page, attaching a cookie with some session ID. 
  • Every time a user requests a page from the server, the browser automatically sends a session ID cookie to the server. The server checks the identifier against its database of identifiers and, if there is such an identifier in the database, “recognizes” the user.

As can be seen from the text, it is enough for the user to have one cookie file, which will contain the session identifier. By this one identifier, the server, to which the request arrives, "recognizes" the client and provides him with all the necessary information - logins, passwords, etc. What is the need for multiple cookies, and as a result, multiple session IDs?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2021-11-23
@saboteur_kiev

In addition to the session ID, you can store anything.
For example, the ID of the last message that you read, and the next time you visit from your browser, you can show you new ones, and not store it all in the database.
And in general, you can store a bunch of critical or non-critical information.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question