Supporting multiple custom RoleProvider versions

C

Chris Cichocki

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
 
S

Steven Cheng[MSFT]

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

Steven Cheng[MSFT]

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top