Type 'Telerik.Sitefinity.Security.UserIdentity' is n

Posted by Community Admin on 04-Aug-2018 21:13

Type 'Telerik.Sitefinity.Security.UserIdentity' is not marked as serializable.

All Replies

Posted by Community Admin on 24-Apr-2013 00:00

I'm receiving this error, "Type 'Telerik.Sitefinity.Security.UserIdentity' in assembly 'Telerik.Sitefinity, Version=5.3.3900.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' is not marked as serializable.",  after logging in from a custom user control and redirect to a different page that looks at a session variable.

Here is my stack trace:
[SerializationException: Type 'Telerik.Sitefinity.Security.UserIdentity' in assembly 'Telerik.Sitefinity, Version=5.3.3900.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' is not marked as serializable.]
Microsoft.VisualStudio.WebHost.Connection.get_RemoteIP() +0
Microsoft.VisualStudio.WebHost.Request.GetRemoteAddress() +65
System.Web.HttpRequest.get_UserHostAddress() +21
Telerik.Sitefinity.Security.Claims.SFClaimsAuthenticationManager.ValidateLimitations(ClaimsPrincipalProxy principal, HttpContext context) +114
Telerik.Sitefinity.Security.Claims.SitefinityClaimsAuthenticationModule.OnPostAuthenticateRequest(Object sender, EventArgs e) +1247
System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +148
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

 Here is my code for logging in the user:

                string username = this.txtUsername.Text;
                string password = this.txtPassword.Text;
                bool rememberMe = this.cbRememberMe.Checked;

                UserLoggingReason loginMessage = UserLoggingReason.Unknown;
                var userManager = UserManager.GetManager("Default");
                MediaSiteSessionHelper helper = new MediaSiteSessionHelper(Application, Session);

                if (Membership.ValidateUser(username, password)) //check to make sure valid username/password
                

                    //Authenticate and log user in
                    string redirectUrl = string.Empty;
                    loginMessage = SecurityManager.AuthenticateUser(UserManager.GetDefaultProviderName(), username, password, rememberMe);

                    if (loginMessage == UserLoggingReason.Success)
                    
                        var manager = UserManager.GetManager();
                        manager.Provider.SuppressSecurityChecks = true;
                        manager.SaveChanges();

                        FormsAuthentication.SetAuthCookie(username, true);

                        var user = userManager.GetUsers().Where(u => u.UserName == username).Single();
                        Guid userID = user.Id;

                        var getUserMode = from extended in context.user_extended_profile
                                          where extended.id == userID
                                          select new
                                          
                                              isTempPassword = extended.isTempPassword,
                                              VerificationDate = extended.verification_date,
                                              IsApproved = extended.is_approved,
                                              ReviewDate = extended.approval_date
                                          ;
                        try
                        
                            //Determine where to send user
                            if (getUserMode.Single().isTempPassword)
                            
                                helper.RequirePasswordChange = true;
                                helper.redirectURL = "/my-account?action=REQCHANGEPWD";
                            
                            else if (!getUserMode.Single().VerificationDate.HasValue)
                            
                                helper.RequireAcctVerification = true;
                                helper.RequireAcctApproval = true;
                                helper.redirectURL = "/my-account/account-status";
                            
                            else if (!getUserMode.Single().IsApproved)
                            
                                if (getUserMode.Single().ReviewDate.HasValue)
                                
                                    helper.AcctWasDenied = true;
                                
                                else
                                
                                    helper.RequireAcctApproval = true;
                                
                                helper.redirectURL = "/my-account/account-status";
                            
                            else
                            
                                if (helper.redirectURL.IsNullOrEmpty())
                                
                                    redirectUrl = "/";
                                
                                else
                                
                                    redirectUrl = helper.redirectURL;
                                    helper.redirectURL = null;
                                
                            
                        
                        catch (Exception err)
                        

                            var userRoles = RoleManager.FindRolesForUser(user.Id);
                            if (userRoles != null)
                            
                                foreach (var role in userRoles)
                                
                                    if (role.Name == "Administrators")
                                    
                                        redirectUrl = "/Sitefinity";
                                    
                                
                            
                            if (redirectUrl.IsNullOrEmpty())
                            
                                SecurityManager.Logout();
                                Common.LogError("Login", err);
                                this.responseText.InnerHtml = "Incorrect Username/Password Combination";
                                this.responseText.Visible = true;
                                return;
                            
                        
                        if (helper.redirectURL.IsNullOrEmpty())
                        
                            Response.Redirect(redirectUrl);
                        
                        else
                        
                            Response.Redirect(helper.redirectURL);
                        
                    
                    else
                    
                        this.responseText.InnerHtml = loginMessage.ToString(); // "Incorrect Username/Password Combination";
                        this.responseText.Visible = true;
                        return;
                    
                
                else
                
                    this.responseText.InnerHtml = "Incorrect Username/Password Combination";
                    this.responseText.Visible = true;
                    return;
                

Posted by Community Admin on 29-Apr-2013 00:00

Hi,

Possible causes for the problem are if you are using visual studio development server (Cassini) to authenticate, use IIS and the problem shouldn`t appear or or perform the authentication trough a proxy server.

All the best,
Stanislav Velikov
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 23-Jan-2017 00:00

I tried as you mentioned in above post but still the issue is not resolved.

Type 'Telerik.Sitefinity.Security.SitefinityIdentity' in assembly 'Telerik.Sitefinity, Version=6.3.5000.0, Culture=neutral, PublicKeyToken=b28c218413bdf563' is not marked as serializable.

This thread is closed