Setting Cookie Secure Flag – ASP.NET
Method #1 Setting Secure Property True
Create Cookie by setting secure property true:
HttpCookie cookie = new HttpCookie('name'); cookie.Secure = True; cookie.Value = 'Value';
Method#2 Using web.config
Add the following codes to web.config
<system.web> <httpCookies requireSSL="true" /> </system.web>
Even when I set secure=True, FireFox’s debugging panel still shows “secure” as “false”.