Cookies in ASP.Net

Cookies can also be set in ASP.NET , to set cookies in you can proceed as follows

    public string GetCookies()
        string myLocation = Request.Cookies[“WHLocation”].Value;
        return myLocation;

    public void SetCookies(string WHLocation)

        HttpCookie WHCookie = new HttpCookie(“WHCookie”);
        WHCookie.Values.Add(“WHLocation”, WHLocation);
        WHCookie.Expires= DateTime.Now.AddDays(1);



Leave a Reply

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