There are several reason that the FormsAuthentication.Encrypt() returns null:
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, // version
identity.Name, // Name
DateTime.Now, // issue date,
DateTime.Now.AddDays(1), // expiration date, created above
false, // persistent or not
jsSerializer.Serialize(identity) // User data
);
string encryptedTicket = FormsAuthentication.Encrypt(ticket);
FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(
1, // version
identity.Name, // Name
DateTime.Now, // issue date,
DateTime.Now.AddDays(1), // expiration date, created above
false, // persistent or not
jsSerializer.Serialize(identity) // User data
);
string encryptedTicket = FormsAuthentication.Encrypt(ticket);
- The Name property of the FormsAuthenticationTicket is null.
- The UserData propery of the FormsAuthenticationTicket is null
- The total length of the UserData is over 4K.
Comments