1
Reply

How to create and remove that cookies in asp.net?

Pradeep

Pradeep

15y
5.2k
0
Reply

    This is the syntax for creating a cookies.
    HttpCookie SiteCookies = new HttpCookie("UserInfo");
    SiteCookies["UserName"] = "Pradeep";
    SiteCookies["sitename"] = "dotnetRed";
    SiteCookies["Expire"] = "5 Days";
    SiteCookies= DateTime.Now.AddDays(5);
    Response.Cookies.Add(SiteCookies);
    Now syntax to remove this cookie:-
    HttpCookie SiteCookies= new HttpCookie("UserInfo");
    siteCookies= DateTime.Now.A
    ddDays(-1);
    Response.Cookies.AddSiteCookies