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 *

6 + 4 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">