Reputation: 940
Is it possible to access a C# created cookie via Javascript and change the value? (I'm aware that it's a security measure - but whats the alternative)
C#
HttpCookie myCookie = new HttpCookie("theName", "theValue");
Response.Cookies.Add(myCookie);
Javascript
console.log(document.cookie) //doesn't include my cookie..
Upvotes: 0
Views: 926
Reputation: 940
HttpCookie is by default protected - i.e. Javascript cannot read them. Setting the following bool property allows access.
myCookie.HttpOnly = false
Upvotes: 1