Cookie,session and browser relationship, application

Source: Internet
Author: User

a . Cookie in the Web application, the cookie class corresponding to the Servlet API is saved on the client.

Purpose: Protects the information that is allowed to be saved by the user when accessing the Web application through a browser.

Implementation: Each Web application has a corresponding cookie file (TXT format) for each browser of the client and is not shared with each other. Where, under the Win7 system, the Internet Explorer cookie file

C:\Users\Administrator\AppData\Roaming\Microsoft\Windows\Cookies path, (Cookies folder may be hidden, set to show). is saved as a key-value pair.

Application: Login website, there is a check to save the password ,

two Session in the Web application , originally intended to be a conversation , corresponding to the Servlet API HttpSession class, saved on the server .

function: In order to make the service side and the client contact , in the server side of the memory specifically for the session to generate an ID for the specific representation of the client's identity.

Implementation: each time the client accesses the server, it will be accessed with the ID assigned to it, otherwise it will be re-generated a new ID. The implementation of the ID from the client to the service side of the process of delivery, there are 2 ways, one is to save the cookie, the ID is placed in the browser's cookie , the other is to rewrite the URL, the path of access to encode, Response.encodeurl (" Access path ")//completed with the ID placed after the URL, and the Chinese characters such as encoding function

Specific to the client, is the usual browser.

Rule: 1. Except for special browser settings, usually a new session ID will be generated for each new browser opened.

2. If you close this window (Not the tab window, the entire browser window, the taskbar window, that is, to stop the browser process), and then reopen the browser, it will also regenerate a Sessioin ID, and will not continue to use the browser just the session Id!

Application: The user name of the login website will be treated as a session by the server.

Three application in a Web application , the ServletContext class corresponding to the Servlet API

Role: Can let all clients share some information, is the service side of their own information.

Cookie,session and browser relationship, application

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.