Home

C# ASP.Net Read Write Cookies

Simple Reminder for reading and writing cookies

using System.Web;

Writing

            HttpCookie MyCookie = new HttpCookie("Keyf");
            MyCookie.Value = "ThisValue";
            MyCookie.Expires = DateTime.Now.AddDays(1);
            Response.Cookies.Add(MyCookie);

Reading

        if (Request.Cookies["Keyf"] != null) {
            string MyString = Request.Cookies["Keyf"].Value;
        }

Reader's Comments

Post Your Comment Posts/Links Rules

Name

Comment

Add a RELEVANT link (not required)

Upload an image (not required)

No uploaded image
Real person number
Please enter the above number below




Home
Admin Ren's Biking Blog