More in this section

Forums / Developing with Sitefinity / Roles and Registration

Roles and Registration

11 posts, 2 answered
  1. Armysniper
    Armysniper avatar
    126 posts
    Registered:
    03 Mar 2005
    27 Aug 2009
    Link to this post
    Are there default roles that need to be assigned to users when you create them?

    I have a custom registration process that creates a user in SiteFinity and then creates a separate set of values for them in a custom table for profile data. I DO NOT use the built in Profile Properties you have defined (do I NEED to?). The problem I noticed is I can get people through registration but then when they login and go to my Edit Profile page they get hit with an error. If the user was created originally with the SiteFinity user create in the Admin they work fine, just not users created with my registration. The error I get is: The type of page you have requested is not served because it has been explicitly forbidden.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Aug 2009
    Link to this post
    Hello Armysniper,

    Do you use the default Sitefinity profile provider of type Telerik.DataAccess.AspnetProviders.TelerikProfileProvider, Telerik.DataAccess? If so it is trying to get the metadata from telerik_UserMetaInfo which is the default table for storing profile data.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Armysniper
    Armysniper avatar
    126 posts
    Registered:
    03 Mar 2005
    27 Aug 2009
    Link to this post
    I have not changed the Profile provider as I do not use the Profile provider for my work but my own database work. I don't make calls to anything related to profiles. I wonder though if I have to provide a role for users though. I don't add people to any when they register.
  4. Armysniper
    Armysniper avatar
    126 posts
    Registered:
    03 Mar 2005
    27 Aug 2009
    Link to this post
    Any idea why I would get that error?
  5. Armysniper
    Armysniper avatar
    126 posts
    Registered:
    03 Mar 2005
    27 Aug 2009
    Link to this post
    It appears this might be a bug. I just changed my EditProfile page that contains my EditProfile control's Allow Anonymous settting to Allow from Deny and now it works. So why am I getting this? I am about to upgrade to 3.7 so I am hoping that is fixed in it.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    31 Aug 2009
    Link to this post
    Hello Armysniper,

    The error : "The type of page you have requested is not served because it has been explicitly forbidden." is thrown because the user you use does not have permissions to see requested page. If a user does not belong to any role he/she does not have rights to view, edit, modify etc. pages and content.
    When Allow Anonymous is set to true - all users can see this page although they might have not been authenticated. When Allow Anonymous is set to false - only authenticated users - that have supplied their credentials have access to a given resources.

    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  7. Armysniper
    Armysniper avatar
    126 posts
    Registered:
    03 Mar 2005
    03 Sep 2009
    Link to this post
    When registering this person with my custom registration...is there a default role they should be assigned to? How do I assign values to the Site Finity profile values such as First Name and Last Name also?
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    03 Sep 2009
    Link to this post
    Hello Armysniper,

    When registering this person with my custom registration...is there a default role they should be assigned to

    There is no default role. You should create a role then set needed permissions to this role. Afterwords add all users that are using your form to this role. If a user does not belong to a role this user can be authenticated but he/she does not have permissions like view, create, edit etc.

    Below is a sample code that illustrates how to add users to a given role and assign ProfileProperties.

    UserManager manager = new UserManager(); 
    manager.AddUserToRole(UserName, role); 
    ProfileBase pbase = ProfileBase.Create(UserName); 
    pbase.SetPropertyValue("FirstName", UserfirstName); 

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  9. Armysniper
    Armysniper avatar
    126 posts
    Registered:
    03 Mar 2005
    05 Sep 2009
    Link to this post
    I have done that code in my registration but unfortunately FirstName and LastName values are not being set. It sets FirstName as the user's email (we are using emails for usernames). Here is the code which is called RIGHT after the user is registered in SiteFinity and our custom profile database.

    // Display appropriate panel.  
                    if (createdMemberID > 0)  
                    {  
     
                        // Add SiteFinity User Profile data.  
                        ProfileBase pbase = ProfileBase.Create(txtEmail.Text);  
                        pbase.SetPropertyValue("FirstName", userProfile.FirstName);  
                        pbase.SetPropertyValue("LastName", userProfile.LastName);  
     
    I have verified that values are being passed in. Here is my web.config for the profile section:

    <profile defaultProvider="Sitefinity">  
          <providers> 
            <clear/> 
            <add name="Sitefinity" connectionStringName="DefaultConnection" applicationName="/" type="Telerik.DataAccess.AspnetProviders.TelerikProfileProvider, Telerik.DataAccess"/>  
          </providers> 
          <properties> 
            <add name="FirstName"/>  
            <add name="LastName"/>  
            <add name="Position"/>  
            <add name="Photo_Hidden"/>  
            <add name="Photo" defaultValue="~/Sitefinity/Common/Images/defaultavatar.gif"/>  
            <group name="InstantMessenger">  
              <add name="IM_Type"/>  
              <add name="IM_Value"/>  
            </group> 
            <group name="Phone">  
              <add name="Value"/>  
              <add name="Type"/>  
            </group> 
          </properties> 
        </profile> 

    Any ideas?
  10. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 Sep 2009
    Link to this post
    Hello Armysniper,

    Do you call pbase.Save(); at the end?

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Answered
  11. Armysniper
    Armysniper avatar
    126 posts
    Registered:
    03 Mar 2005
    07 Sep 2009
    Link to this post
    I figured out that was the issue. ;) Thanks!
Register for webinar
11 posts, 2 answered