Saturday, 15 June 2013

c# - ASP.NET 4.5 authentication cookie is not persisted on Azure Web Role -


I have problems with form authentication on my Azure WebRole. I do not store authentication cookies for this login once user After starting a new session, it will have to login again. First of all, I tried:

  FormAssification. SetAuthCookie (User ID, Remember);  

are now doing it manually:

  var ticket = new form authentication ticket (1, user id, date time.Now, datetime.now.admnthth (6), I remember, string. Empty, form attribution. Firmkeypath); Var EncryptedTetic = FormAssification. Encrypt (ticket); Var cookie = new HTTPQQ (form authentication. Formscu cookies, encrypted content) {Path = FormsAuthentication.FormcookPath, HTTPOnly = true}; If (Remember ME) {cookie.Expires = ticket.Expiration; } Response.Cookies.Add (cookie);  

A snippet from web.config here:

  & lt; Machine decryption = "auto" decryption key = "& my; my decryption key"; Verification = "SHA1" verification key = "& lt; MyValidationKey & gt;" / & Gt; & Lt; Authentication mode = "form" & gt; & Lt; Forms loginUrl = "~ / account / login" sliding aspiration = "true" timeout = "2880" cookieless = "UseCookies" /> & Lt; / Authentication & gt;  

But the problem remains. Sometimes this is remembered? Because this is going on in some Ezur Webber, we have the machine's web. Added to the config.

The problem may not be related to the esurar web roll, because we saw the same behavior, running locally for example. Local Host: 7778


No comments:

Post a Comment