ssl-security

How can I set the Secure flag on an ASP.NET Session Cookie?

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 08:48:37
问题 How can I set the Secure flag on an ASP.NET Session Cookie, so that it will only be transmitted over HTTPS and never over plain HTTP? 回答1: There are two ways, one httpCookies element in web.config allows you to turn on requireSSL which only transmit all cookies including session in SSL only and also inside forms authentication, but if you turn on SSL on httpcookies you must also turn it on inside forms configuration too. Edit for clarity: Put this in <system.web> <httpCookies requireSSL="true