Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Security > Use Custom Memberhip and RoleProvider type in sitefinity

Use Custom Memberhip and RoleProvider type in sitefinity

  • wajimam avatar

    Posted on Jan 24, 2010 (permalink)

    Hello,
    I had created 2 class ApplicationProvider extends TelerikMembershipProvider and RoleProvider extends TelerikRoleProvider for override the ApplicationName property and I set in web.config


      <roleManager enabled="true" cacheRolesInCookie="true" defaultProvider="Sitefinity">
          <providers>
            <clear />
            <add connectionStringName="DefaultConnection"
              name="Sitefinity" type="RoleProvider,TelerikProviders" />
          </providers>
        </roleManager>
        <membership defaultProvider="Sitefinity" userIsOnlineTimeWindow="15" hashAlgorithmType="">
          <providers>
            <clear />

            <add name="Sitefinity" connectionStringName="DefaultConnection" type="ApplicationProvider,TelerikProviders" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false"  requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression="" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0" />
            
          </providers>
        </membership>


    but when I use only Membership provider class its work fine but when I use RoleProvider class it give me the error

    can you give me the suggestion I use my custom provider type .

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Jan 24, 2010 (permalink)

    Hi wajimam,

    Try overriding Initialize method of TelerikRoleProvider and call DataConnection.Initialize(false, this.GetType().Assembly);

    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.

    Reply

  • wajimam avatar

    Posted on Jan 25, 2010 (permalink)

    Hello I use the code as you suggest me but still it give me the same error

    My code :

     public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            DataConnection.Initialize(false, this.GetType().Assembly);
            base.Initialize(name, config);
        }


    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Jan 25, 2010 (permalink)

    Hi wajimam,

    Try calling only base.Initialize() without any other code. If the problem persists you can send the log file so we could see whether there will be any useful information there.

    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.

    Reply

  • wajimam avatar

    Posted on Jan 26, 2010 (permalink)

    i had tried your suggestion but still same error as you suggest me that use only base.Initiallize() but there is no base.Initiallize() method for override
    I same sending you my code file please check it

    thanks
    using System; 
    using System.Data; 
    using System.Configuration; 
    using System.Web; 
    using System.Web.Security; 
    using System.Web.UI; 
    using System.Web.UI.WebControls; 
    using System.Web.UI.WebControls.WebParts; 
    using System.Web.UI.HtmlControls; 
    using Nolics.ORMapper.Base; 
    using Telerik.DataAccess.AspnetProviders; 
     
    /// <summary> 
    /// Summary description for RoleProvider 
    /// </summary> 
    public class RoleProvider : TelerikRoleProvider 
        public override string ApplicationName 
        { 
            get 
            { 
                string appNameFromContext = 
                (string)HttpContext.Current.Items["ApplicationName"]; 
                if (appNameFromContext != "NOTSET"
                    return appNameFromContext; 
                else 
                    return base.ApplicationName; 
            } 
        } 
     
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) 
        { 
            DataConnection.Initialize(falsethis.GetType().Assembly); 
            base.Initialize(name, config); 
        } 

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Jan 26, 2010 (permalink)

    Hi wajimam,

    Try using this code in a custom dll

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using Nolics.ORMapper.Base;
    using Telerik.DataAccess.AspnetProviders;
     
    /// <summary>
    /// Summary description for RoleProvider
    /// </summary>
    ///
    namespace Telerik.Samples
    {
        public class RoleProvider : TelerikRoleProvider
        {
            public override string ApplicationName
            {
                get
                {
                    string appNameFromContext =
                    (string)HttpContext.Current.Items["applicationName"];
                    if (appNameFromContext != "/")
                        return appNameFromContext;
                    else
                        return base.ApplicationName;
                }
            }
     
            public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
            {
                DataConnection.Initialize(false, typeof(TelerikRoleProvider).Assembly);
                base.Initialize(name, config);
     
            }
     
        }
    }


    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.

    Reply

  • Register for webinar
Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Security > Use Custom Memberhip and RoleProvider type in sitefinity