Quantcast
Channel: Security Vulnerability
Viewing all articles
Browse latest Browse all 317

Forms Authentication cookie is expired too soon

$
0
0

We are setting auth cookie as follows:

var authTicket = new FormsAuthenticationTicket            (                1, principal.Email, DateTime.Now, DateTime.Now.AddMinutes(1200),                falseJsonConvert.SerializeObject(principal), FormsAuthentication.FormsCookiePath            );            var enTicket = FormsAuthentication.Encrypt(authTicket);            var cookies = new HttpCookie(FormsAuthentication.FormsCookieName, enTicket)            {                Expires = DateTime.Now.AddMinutes(1200)            };            response.Cookies.Add(cookies);

This cookie expires in 10 mins. Windows log viewer says:
Event code: 4005
Event message: Forms authentication failed for the request. Reason: The ticket supplied was invalid.

Any ideas what can happen and how to fix that?

Viewing all articles
Browse latest Browse all 317

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>