I have a project build on Asp.net MVC 4 and in our application we need to make the session cookie secure.
I have tried this code to make my cookie secure.
var encryptedTicket = FormsAuthentication.Encrypt(authenticationTicket);
httpContext.Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket) { Secure = true, HttpOnly = true });
Also in webconfig file
<httpCookies httpOnlyCookies="true" requireSSL="true" />
The issue is when I am using HttpOnly = true, application is able to create the cookie successfully.
But when I tried also with secure = true, cookie was not created and user never gets logged in.
After login
Can somebody please help where i am getting wrong.
Thanks in advance.