In a nutshell, you can control which provider is the "default" provider by
setting the "defaultProvider" property that is on the <membership>, <roles>,
<profile> elements in web.config. When you do this, then calls to:
Membership.ValidateUser(username, password)
And other methods on the Membership class will go to the default provider. You
can programmatically call another provider by accessing it via the "Providers"
collection on the Membership/Roles API. For example:
Membership.Providers["otherprovider"].ValidateUser(username,password)
Note that the "otherprovider" name is determined by the <add/> element in your
web.config file (where you give each provider a name).
Hope this helps,
Scott
-----Original Message-----
From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf
Of Sébastien Lorion
Sent: Wednesday, November 29, 2006 6:06 AM
To: [email protected]
Subject: Re: [ADVANCED-DOTNET] Multiple Membership Providers
You need to loop over System.Web.Security.Membership.Providers and
somehow find the provider you want, e.g. by checking its type and/or
some properties.
Sébastien
On 11/29/06, Angel Java Lopez <[EMAIL PROTECTED]> wrote:
> Hi people!
>
> At MSDN article:
>
> Membership Providers
> http://msdn2.microsoft.com/en-us/library/sx3h274z.aspx
>
> I read
>
> You can also configure multiple membership providers, which allows you to
> select a membership provider at run time based on application requirements.
> For example, for business reasons your membership information might be in
> separate regional databases. By configuring multiple membership providers
> that each interact with a different regional database, you can direct
> membership calls to the appropriate provider for different users.
>
> But I can't found any sample code or explanation on how to specify the
> membership provider to use at runtime.
>
> Any info, welcome!
>
> Angel "Java" Lopez
> http://www.ajlopez.com/en
> http://ajlopez.wordpress.com/
>
> ===================================
> This list is hosted by DevelopMentor(r) http://www.develop.com
>
> View archives and manage your subscription(s) at http://discuss.develop.com
>
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
===================================
This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com