title: Issue with setting session cookie http and secure to true
body: <p>I have a project build on Asp.net MVC 4 and in our application we need to make the session cookie secure.</p>
  
  <p>I have tried this code to make my cookie secure.</p>
  
  <pre><code>var encryptedTicket = FormsAuthentication.Encrypt(authenticationTicket);
  httpContext.Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket) { Secure = true, HttpOnly = true });
  </code></pre>
  
  <p>Also in webconfig file </p>
  
  <pre><code>&lt;httpCookies httpOnlyCookies="true" requireSSL="true" /&gt;
  </code></pre>
  
  <p>The issue is when I am using HttpOnly = true, application is able to create the cookie successfully.</p>
  
  <p>But when I tried also with secure = true, cookie was not created and user never gets logged in.</p>
  
  <p>After login
  <img src="https://i.stack.imgur.com/1g7eC.png" alt="enter image description here">
  Can somebody please help where i am getting wrong.</p>
  
  <p>Thanks in advance.</p>