Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

httpCookies requireSSL set to true on http does not cause any errors

I have set the httpCookies requireSSL value to true in web.config and run the web app on my local machine without https running. All runs fine apart from when I try and read the Request.Cookie.

Its not there. I assume because I don't have SSL enabled it never created it but there was no warning that it failed. I only know when I try to read a cookie value.

Should it not warn you?

like image 791
Jon Avatar asked Nov 10 '09 15:11

Jon


People also ask

What is requireSSL true?

Sensitive data that is transmitted using HTTP is vulnerable to being read by a third party. By default, web forms and cookies are sent via HTTP, not HTTPS. This setting can be changed by setting the requireSSL attribute to "true" in Web.

What is the use of requireSSL?

The RequireSSL property enables or disables output of the secure cookie attribute as described in RFC 2109. When used by compliant browsers, the cookie will only be sent back over a connection using SSL/TLS. The default is false .

How to set Secure cookie in asp net?

Mark cookies as Secure Cookies. Add( new HttpCookie("key", "value") { Secure = true, }); That's it!


1 Answers

No. What the setting does is that it sends the 'Secure' parameter when setting the cookie. After receiving a cookie with that parameter, the client should only send it back to the server when the connection used is secure.

That's is why the client is not sending back the cookie and you're not seeing it. Also, the server should not send set this type of cookie over an insecure connection.

See RFC-2109, section 4.2.2 for the explanation on how the 'Secure' attribute is used and interpreted.

like image 132
Gonzalo Avatar answered Sep 19 '22 17:09

Gonzalo