More in this section

Forums / Developing with Sitefinity / Sitefinity page access to loggedin users

Sitefinity page access to loggedin users

7 posts, 0 answered
  1. sarath
    sarath avatar
    24 posts
    Registered:
    24 Jan 2010
    01 Feb 2010
    Link to this post
    I have a custom login control, which will verifies the user credentials. The user details are stored in the different database( not the sitefinity database). I want to acces the sitefinity pages when the user loggedin. If the user don't login to the site i don't want to give access to sitefinity pages.

    Currently what is happening is, forexample user "A" logged in with password "A", the login control checks the user credentials from the custom database(not the sitefinity database) and returns the role i.e "X". to get work In sitefinity i have created the same user called "A" and given the role "AD". So the user "A" is able to see the pages when he logged in.

    But I don't want to create any users in the SItefinity to access the pages when the user logged in. How to solve this problem...

    Thanks,
    sarath
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    01 Feb 2010
    Link to this post
    Hello sarath,

    Since you have existing users and roles in another database you are probably using membership and role providers there (ASP.NET Membership Provider for example). Sitefinity can work with user coming from external sources Active Directory users and users from existing membership providers. What you have to do is to add a connection string to the DB holding membership info and then add your membership and role providers in the appropriate sections in the web.config. More information can be found here:

    Membership Providers

    Role Providers

    Implementing Multiple Membership Providers

    You can also take a look at the following webinar, where we sample how to create a custom membership provider and add it to Sitefinity: Sitefinity Membership & Role Providers.

    Sincerely yours,
    Radoslav Georgiev
    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. Jason M
    Jason M avatar
    108 posts
    Registered:
    15 Jan 2007
    01 Feb 2010
    Link to this post
    I found the following site really helpful when creating our Membership/Role classes:
    http://www.milestre.nl/English/News/Latestnews/CustomMembershipAndRoleProvider.aspx


    J
  4. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    01 Feb 2010
    Link to this post
    Hello Jason M,

    We are happy to see that you have managed to create your custom membership and role providers and sharing your experience with the community.

    If you have more questions, please feel free to contact us.

    Regards,
    Radoslav Georgiev
    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.
  5. sarath
    sarath avatar
    24 posts
    Registered:
    24 Jan 2010
    01 Feb 2010
    Link to this post
    Thank you Radoslav and Jason for your quick help.

    I have read earlier discussion thread also where Jason shared the info.
    http://www.sitefinity.com/support/forums/sitefinity-3-x/developing-with-sitefinity/membership-and-role-providers-permissions.aspx

    Thank you Jason.

    My project is in analysis/design phase, I was thinking how to implement this functionality, whether it's possible or not. After reading your threads I got the confidence that I can implement this functionality.

    If I have any questions I will post it in the coding phase.

    Once again thank you for your quick help.

    Regards,
    Sarath
  6. sarath
    sarath avatar
    24 posts
    Registered:
    24 Jan 2010
    05 Feb 2010
    Link to this post
    Hi,
    Please see the below settings, I followed the as per KB article, I am not able to login to the site. 

    <roleManager enabled="true" cacheRolesInCookie="true" defaultProvider="CustomSqlProvider">
          <providers>
            <clear />
            <add connectionStringName="DefaultConnection" applicationName="/"
              name="Sitefinity" type="Telerik.DataAccess.AspnetProviders.TelerikRoleProvider, Telerik.DataAccess" />
            <!-- Custom Role Manager Provider-->
            <add name="CustomSqlProvider"
              type="System.Web.Security.SqlRoleProvider"
              connectionStringName="SqlServices"
              applicationName="/" />
          </providers>
        </roleManager>
        <membership defaultProvider="CustomSqlProvider" userIsOnlineTimeWindow="15" hashAlgorithmType="">
          <providers>
            <clear />
            <add name="Sitefinity" connectionStringName="DefaultConnection" type="Telerik.DataAccess.AspnetProviders.TelerikMembershipProvider, Telerik.DataAccess" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression="" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" />
            <!-- Custom Membership Provider-->
            <add name="CustomSqlProvider"
              type="System.Web.Security.SqlMembershipProvider"
              connectionStringName="SqlServices"
              applicationName="/"
              />
          </providers>
        </membership>

    <connectionStrings>
             <add name="Sitefinity" connectionString="data source=<CMSSERVER>;UID=<UID>;PWD=<PWD>;initial catalog=<CMSDB>"
              providerName="System.Data.SqlClient" />
        <!-- Custom Connection String -->
        <add name="SqlServices"
             connectionString="Data Source=.\SQLExpress;Integrated Security=SSPI;User Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf" />
      </connectionStrings>

    <security defaultProvider="DefaultSecurityProvider" cmsProvidersName="CustomSqlProvider">
          <roles>
            <clear />
            <add name="Sitefinity" permission="Unrestricted" />
          </roles>
          <providers>
            <clear />
            <add name="DefaultSecurityProvider" connectionStringName="DefaultConnection" 
                 type="Telerik.Security.Data.DefaultSecurityProvider, Telerik.Security.Data" 
                 membershipProvider="CustomSqlProvider" roleProvider="CustomSqlProvider" />
          </providers>
        </security>

    I have created a test user called "abc" and trying to login to the site, I am getting Invalid Login name or Password

    is there anything I am missing.

    Thanks,
    Sarath
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    07 Feb 2010
    Link to this post
    Hello sarath,

    The web.config settings seems to be correct, but the users seems even not authenticated. Your membership provider cannot validate it. Please check whether the AD and its roles/users are correctly configured.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
    Follow the status of features or bugs in PITS and vote for them to affect their priority.
Register for webinar
7 posts, 0 answered