In this article I am trying to explain Cookies in ASP.NET.
Cookies
A cookie is a piece of information in the form of a very small text file placed on an internet user's hard drive. It is generated by a web page server that is basically the computer that operates a web site. The user can also change the cookie before the browser sends it to you. So never store a password, username, email, pan number in cookies. We can declare at least 300 cookies per website and at least 4096 bytes per cookie.Now the question is, how tp declare a Cookie.
1st way
3rd way
We can write multiple values in each cookie.
How we access cookies
The following describes how to access cookies.For 1st way and 2nd way we use:
CreateCookie.aspx.cs
After clicking the submit button the page is rendered to the ResulCookis.aspx page and shows the cookie value as in the following:
Here after clicking on the delete all the cookies button, it deletes a cookie as in the following:
Hands on ASP.NET GridView