Supporting multiple custom RoleProvider versions

Discussion in 'ASP .Net Security' started by Chris Cichocki, Sep 22, 2006.

  1. All of the configurations I've seen for the role provider specify a simple
    (weak) type name. What if I had multiple custom role provider
    implementations in the GAC and wanted to specify an exact version? I've
    tried putting the fully qualified (strong) name into the "type" attribute but
    it says it can't load the type. Am I missing something or is a simple type
    name all that can be used?

    Thanks
    Chris
     
    Chris Cichocki, Sep 22, 2006
    #1
    1. Advertising

  2. Hello Chris,

    As for the the "roleManager" providers, ASP.NET 2.0 does support multiple
    providers configured in appilcation web.config file. And you can point to
    the RoleProvider type in both GAC or application's private bin dir. And
    for private bin assembly, since they're not strong-named, you can simply
    supply the main assembly name(do not need version, culture and public key
    token info...). For assembly in GAC, you need to supply all the four parts
    (assembly name, version, culture, pubic key token ) for it. For example:


    ====================
    <roleManager defaultProvider="NewAspNetSqlRoleProvider">
    <providers>
    <add name="NewAspNetSqlRoleProvider"
    connectionStringName="LocalSqlServer"
    applicationName="MyApplication"
    type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0,
    Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

    <add name="customprovider" .....................
    type="MyProviders.CustomRoleProvider,
    myproviders" />

    </providers>
    </roleManager>

    ====================

    Also, if you're not sure about the exact synatx of the
    assemblyQualifiedname of your provider type(in GAC) ,you can use the
    following code to print it out:
    ===================
    protected void Page_Load(object sender, EventArgs e)
    {
    Response.Write("<br/>FullTypeName: " +
    typeof(SqlRoleProvider).AssemblyQualifiedName);
    }
    =====================

    In addition, if the problem is that the runtime failed to load the correct
    assembly, you can use the framework tool(Assembly binding viewer) to trace
    the load process of any assembly loading failure.

    #Assembly Binding Log Viewer (Fuslogvw.exe)
    http://msdn2.microsoft.com/en-us/library/e74a18c4.aspx

    Please feel free to let me know if the above helps or if you meet any
    further problems on this.


    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead



    ==================================================

    Get notification to my posts through email? Please refer to
    http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
    ications.



    Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
    where an initial response from the community or a Microsoft Support
    Engineer within 1 business day is acceptable. Please note that each follow
    up response may take approximately 2 business days as the support
    professional working with you may need further investigation to reach the
    most efficient resolution. The offering is not appropriate for situations
    that require urgent, real-time or phone-based interactions or complex
    project analysis and dump analysis issues. Issues of this nature are best
    handled working with a dedicated Microsoft Support Engineer by contacting
    Microsoft Customer Support Services (CSS) at
    http://msdn.microsoft.com/subscriptions/support/default.aspx.

    ==================================================



    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Sep 25, 2006
    #2
    1. Advertising

  3. Hi Gaurav,

    Thanks for your reply.

    Yes, no matter how many providers we configured in our application, only
    one default provider is used. However, this is the case if we use the
    default provider (those special class rather than directly reference the
    provider instance) in our application code. Actually, we can
    programmticaly get the reference to each provider we've configured in
    application web.config and use them in our application, e.g.

    ================

    Membership.Providers["customProvider1"].ValidateUsertxtUsername.Text,
    txtPassword.Text);

    ===================

    The following MSDN article also demonstrate this:

    **How To: Use Forms Authentication with Active Directory in Multiple
    Domains in ASP.NET 2.0
    http://msdn.microsoft.com/library/en-us/dnpag2/html/PAGHT000021.asp?frame=tr
    ue


    Sincerely,

    Steven Cheng

    Microsoft MSDN Online Support Lead


    This posting is provided "AS IS" with no warranties, and confers no rights.
     
    Steven Cheng[MSFT], Sep 27, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Olbert
    Replies:
    0
    Views:
    648
    Mark Olbert
    Jan 10, 2006
  2. Replies:
    0
    Views:
    420
  3. Tomasz
    Replies:
    8
    Views:
    2,023
    Steven Cheng[MSFT]
    Mar 26, 2007
  4. SJ
    Replies:
    3
    Views:
    369
    MikeS
    Feb 22, 2006
  5. Keith Patrick
    Replies:
    1
    Views:
    684
    Dominick Baier
    Aug 20, 2006
Loading...

Share This Page