More in this section

Forums / Bugs & Issues / Problem while assigning default role while user creation

Problem while assigning default role while user creation

3 posts, 1 answered
  1. Jesse
    Jesse avatar
    12 posts
    Registered:
    24 Aug 2012
    24 Aug 2011
    Link to this post
    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



  2. Lubomir Velkov
    Lubomir Velkov avatar
    688 posts
    Registered:
    03 Nov 2014
    26 Aug 2011
    Link to this post
    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,
    Lubomir Velkov
    the Telerik team

    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 >>

    Answered
  3. Jesse
    Jesse avatar
    12 posts
    Registered:
    24 Aug 2012
    01 Sep 2011
    Link to this post
    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
3 posts, 1 answered