I have a problem with creating HttpOnly Cookies , I use the following code to creat new cookie:
//A.aspx HttpCookie ht = new HttpCookie("www"); ht.Value = "www"; ht.Name = "www"; ht.HttpOnly = true; ht.Expires = DateTime.Now.AddDays(1); Response.AppendCookie(ht); Response.Redirect("B.aspx"); //B.aspx HttpCookie cookie = Request.Cookies["Allowed"]; HttpCookie htt = Request.Cookies["www"]; if (cookie != null) { Response.Write(cookie.HttpOnly); Response.Write(htt.HttpOnly); } else { cookie = new HttpCookie("Allowed"); cookie.HttpOnly = true; cookie.Value = "ping"; cookie.Expires = DateTime.Now.AddMinutes(2); Response.Cookies.Add(cookie); Response.Write(cookie.HttpOnly); Response.Write(htt.HttpOnly); } The problem is that the final result is always : False, although the HttpOnly property is set to True .
Can anyone explain me a way to figure this out ?
Thanx