Invalid value for encryptedTicket parameter

前端 未结 4 1262
离开以前
离开以前 2021-02-20 10:34

I recently modified the login for my companies eComm site to have a \"Keep me logged in\" feature. The primary change was to make the forms authentication cookie persistent for

4条回答
  •  野的像风
    2021-02-20 11:00

    I have faced same issue this is because I was getting null or empty value of authCookieValue . So my suggestion is that you have to check null for HttpCookie and also for it's value as given below .

    HttpCookie authCookie = System.Web.HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
            if (authCookie != null)
            {
                //Extract the forms authentication cookie
                if (!string.IsNullOrEmpty(authCookie.Value))
                {
                    FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
    
                    string email = authTicket.UserData;
    
                    // and now process your code as per your condition
    
                }
            }
    

    This will definately will help you .

提交回复
热议问题