Difference Session, Cookie and Application of

contact

Cookie and Session are to maintain the cross-state solution between the client and server, Application is a web application, provides a global state of the application,All clientsYou can use this status

Cookie

Cookie is a small piece of text information. When a client requests a server, if the server needs to record the status of the client, may then transmit a response to the client browser Cookie response to the client, so the client saved Cookie. When a browser requests that site, the browser and put their request to the server with Cookie, the server checks the client's Cookie, using this approach to identify the status of the client.
Cookie server can also modify the content according to demand.

Session

Session also as a mechanism to save the user state. But Session state is stored on the client server. When a client requests a server, if the server needs to record the user's state, to create and generate corresponding Session SessionID, save the user state, and to this response back to the client SessionID stored; if the server there has been the state of the user, the client according to the SessionID Session state retrieved.
The client saved this sessionid methods can be used cookie mechanism, so that during the interaction browser can automatically in accordance with the rules of this logo play to the server; if the browser to disable Cookie, you can be sessionid back to the server via URL rewriting mechanism.

Session and Cookie contrast

  • Implementation: Session generally depends on the implementation mechanism Cookie, Cookie mechanism by return SessionID.
  • Size limit: Cookie limited in size, and the number of general Cookie browser at each site allows relevant; Session no such restrictions.
  • Safety aspects: Cookie security risk, you can find a local browser Cookie to operate the server, Session stored on the server side, relatively more secure.
  • Resource consumption: Session saved on the server side (after a period of time will disappear), will look to the server each time pressure.

Application

Application: corresponds to a Web application that provides a global state of the application, all clients can use this state.

Published 52 original articles · won praise 26 · views 3396

Guess you like

Origin blog.csdn.net/weixin_43796685/article/details/104584204