Cookies in ASP.Net

Cookies in ASP.Net C#

Cookies are small Pieces if text file, Stored on the Client Computer.
There are many name of cookies like HTTP Cookie, Web Cookie, Browser Cookie, Session Cookie.
Create Cookies
Response.Cookies[“MeeraAcademy”].Value = txtvalue.Text;
Response.Cookies[“MeeraAcademy”].Expires = DateTime.Now.AddYears(30);
Retrieve Cookies on web page

if (Request.Cookies[“MeeraAcademy”] == null)
        {
            TextBox1.Text = “No cookie found”;
        }
        else
        {
            TextBox1.Text = Request.Cookies[“MeeraAcademy”].Value;
        } 

 

Leave a Reply

Your email address will not be published. Required fields are marked *

19 − 6 =