Jeff
Jeff

Reputation: 14279

New cookie not present in Response.Cookies

I have the following method that creates a cookie in the page's response. Immediately after I create the cookie, I checked to see what the value was and it was blank. Is this normal behavior? How can I check the response for a cookie after it has been added?

When I monitor the HTTP response, the cookie is there. When I use the Firefox Web Developer Toolbar to view the cookie, it is there. However, it doesnt appear to be present in the Response.Cookies collection. How do I access it?

Dim c As New HttpCookie("prpg")
c.Expires = DateTime.Now.AddYears(10)
c.Value = value
_page.Response.Cookies.Add(c)

_page.Response.Cookies("prpg").Value    'String.Empty

Upvotes: 1

Views: 336

Answers (1)

IvanH
IvanH

Reputation: 5139

You can only write to Response not read from it. So I suppose it is not possible to read cookies too.

Upvotes: 1

Related Questions