Problem while assigning default role while user creation
I am facing very weird problem in my live site registration. I am getting following error in my error log.
No row for Telerik.Sitefinity.Security.Model.UserLink ('sf_user_link') GenericOID@8b172e45 UserLink id=90f66cb0-97e1-4141-b59e-8ce21666752c
As far as my knowledge the sf_user_link table to store the user and related role information. While registration I am using following code to assign GeneralUser role to user.
RoleManager Rmanager = RoleManager.GetManager("Default");
userManager.Provider.SuppressSecurityChecks = true;
Rmanager.AddUserToRole(user, Rmanager.GetRoles().Where(q => q.Name == "GeneralUsers").FirstOrDefault());
The error information I am getting is not very clear so help me to solve this issue.
Yes, this table is used for this. Is your "user" object already persisted in the database, before you assign a role to him/her? You should probably call userManager.SaveChanges() before assigning a role to this user.Greetings,
Thank you for support.
After some changes in registration steps and sequence this issue looks resolved. The error is not occurring.