1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Editing of cookies in C

Discussion in 'C' started by techinspiration, Apr 15, 2010.

  1. techinspiration

    techinspiration New Member

    Joined:
    Feb 14, 2010
    Messages:
    54
    Likes Received:
    0
    Trophy Points:
    0
    Here is the Code in C#:

    HttpCookie myCookie = new HttpCookie("MyTestCookie");
    DateTime now = DateTime.Now;

    // Set the cookie value.
    myCookie.Value = now.ToString();
    // Set the cookie expiration date.
    myCookie.Expires = now.AddMinutes(1);

    // Add the cookie.
    Response.Cookies.Add(myCookie);

    Response.Write("<p> The cookie has been written.");
     

Share This Page