James123
James123

Reputation: 11662

asp.net cookie secure failing on localhost

I am trying to make asp.net cookie secure like Response.Cookies["username"].Secure = true. Some reason these are failing. I mean after login I am setting this then new page is showing error "Page can not displyed".

Response.Cookies["username"].HttpOnly= true is working for all cookies. not Secure.

Is it because I am using on localhost? does it need https://?

Upvotes: 3

Views: 911

Answers (1)

Mark Fitzpatrick
Mark Fitzpatrick

Reputation: 1624

The Secure property of an HttpCookie means that the cookie is only transmitted over SSL. So to test it you need to self-generate a certificate and have your site respond to https requests as well.

Upvotes: 1

Related Questions