Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
Introduction to asp.net|cookie| Programming
This article outlines the application of cookies in asp.net applications, showing you the technical details of applying cookies in asp.net, such as writing cookies and then reading them. You will also be presented with a variety of features and special circumstances for cookies, as well as asp.net support for cookies.
What is a Cookie?
A Cookie is a small piece of textual information that accompanies the user request and the page is passed between the WEB server and the browser. Each time a user accesses a site, the WEB application can read the information that the Cookie contains.
Suppose that when a user requests access to a page on the www.contoso.com of your Web site, your application sends more than one page to the user and a Cookie containing the date and time. The user's browser gets the Cookie at the same time as the page and saves it to a folder on the user's hard disk.
Later, if the user accesses a page on your site again, when the user enters a URL www.contoso.com, the browser looks for a Cookie associated with the URL on the local hard disk. If the Cookie exists, the browser sends it to your site along with the page request, and your application can determine the date and time that the user last visited the site. You can send a message to the user based on this information, or you can check the expiration time or perform other useful functions.
Cookies are associated with a Web site rather than a specific page, so browsers and servers will exchange www.contoso.com Cookie information regardless of which page the user requests to browse the site. When users visit other sites, each site may send a cookie to the user's browser, and the browser will save all of these cookies separately.
Cookies can be used for a variety of purposes, all for the purpose of keeping your Web site in mind. For example, a site that implements a poll can simply use a cookie as a Boolean to indicate whether your browser is already voting, so that the site that requires the user to log on will be able to determine whether you have logged in by using a cookie, so you don't have to enter your credentials every time.
For more background information on cookies, it is recommended that you read the "How Internet cookies Work" in Verizon's Web site, address http://www22.verizon.com/about/community/ Learningcenter/articles/displayarticle1/0,4065,1022z1,00.html (English). The author explains in detail what cookies are and how cookies exchange information between browsers and servers, and he also sums up the privacy issues involved in cookies.
By the way, do you want to know why they are called "cookies"? The Jargon File (also known as the "the New Hacker") version 4.3.3 gives an accurate definition and a reasonable explanation of the etymology of the term. You can find the relevant entry in Http://www.catb.org/~esr/jargon/jargon.html#cookie (English).
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.