Problem while assigning default role while user creation
Hi Team,
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());
Rmanager.SaveChanges();
The error information I am getting is not very clear so help me to solve this issue.
Regards,
Jesse
Hello Jesse,
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 being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>
Hi Lubomir,
Thank you for support.
After some changes in registration steps and sequence this issue looks resolved. The error is not occurring.
Regards,
Janak Darji