473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

How to Change Membership provider during runtime

Hi All,

Can I use more than one membership provider for a given website? I
understand only one of them could be default one. If yes, then how to
programmatically access the other membership provider? For e.g. lets say I
have a SQLMembership provider and OracleMembership provider. SQL would be my
default provider. During authentication, based on the value of an additional
parameter in the login screen, I need to validate against SQL or Oracle db.
Is this feasible?

I found this on MSDN

“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.”

http://msdn2.microsoft.com/en-us/library/sx3h274z.aspx
Any idea on how to switch Membership provider during runtime?

Thanks for tip,
-Balaji NJL
Jul 5 '06 #1
2 14110
Hi Balaji,

You need to make sure all the membership providers are listed in the
web.config file, like this:

<membership defaultProvider="Mydefaultprovider">
<providers >
<clear/>
<add connectionStringName="ASPNETDBConnectionString1"
name="MyOracleprovider"
type="System.Web.Security.OracleMembershipProvider "/>
<add connectionStringName="ASPNETDBConnectionString2"
name="Mydefaultprovider" type="System.Web.Security.SqlMembershipProvider"/>
</providers>
</membership>

Then in your code, reference the one you want to use:

Dim mbr As MembershipProvider
mbr = Membership.Providers.Item("MyOracleprovider")
' mbr.CreateUser(....
Response.Write(mbr.GetType)

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]
"Balaji" <Ba****@discussions.microsoft.comwrote in message
news:92**********************************@microsof t.com...
Hi All,

Can I use more than one membership provider for a given website? I
understand only one of them could be default one. If yes, then how to
programmatically access the other membership provider? For e.g. lets say I
have a SQLMembership provider and OracleMembership provider. SQL would be
my
default provider. During authentication, based on the value of an
additional
parameter in the login screen, I need to validate against SQL or Oracle
db.
Is this feasible?

I found this on MSDN

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

http://msdn2.microsoft.com/en-us/library/sx3h274z.aspx
Any idea on how to switch Membership provider during runtime?

Thanks for tip,
-Balaji NJL


Jul 6 '06 #2
That helps, Thanks a lot.

"Ken Cox [Microsoft MVP]" wrote:
Hi Balaji,

You need to make sure all the membership providers are listed in the
web.config file, like this:

<membership defaultProvider="Mydefaultprovider">
<providers >
<clear/>
<add connectionStringName="ASPNETDBConnectionString1"
name="MyOracleprovider"
type="System.Web.Security.OracleMembershipProvider "/>
<add connectionStringName="ASPNETDBConnectionString2"
name="Mydefaultprovider" type="System.Web.Security.SqlMembershipProvider"/>
</providers>
</membership>

Then in your code, reference the one you want to use:

Dim mbr As MembershipProvider
mbr = Membership.Providers.Item("MyOracleprovider")
' mbr.CreateUser(....
Response.Write(mbr.GetType)

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]
"Balaji" <Ba****@discussions.microsoft.comwrote in message
news:92**********************************@microsof t.com...
Hi All,

Can I use more than one membership provider for a given website? I
understand only one of them could be default one. If yes, then how to
programmatically access the other membership provider? For e.g. lets say I
have a SQLMembership provider and OracleMembership provider. SQL would be
my
default provider. During authentication, based on the value of an
additional
parameter in the login screen, I need to validate against SQL or Oracle
db.
Is this feasible?

I found this on MSDN

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

http://msdn2.microsoft.com/en-us/library/sx3h274z.aspx
Any idea on how to switch Membership provider during runtime?

Thanks for tip,
-Balaji NJL


Jul 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Larry Pits | last post by:
Hi All, Is there any code for ASP.Net to programmatically change the server name within crystal reports? I looked for all technical document at cystal decision site, but no luck. TIA
5
by: Markus Stehle | last post by:
Hi all! I have asp.net web application that uses static impersonation. Is it possible to change the impersonated user during runtime? Within some parts of my application I would like to...
2
by: John | last post by:
Hi I was working fine with create user wizard and the default membership provider. I have now customised the membership provider as per attached web.config. The create user wizard picks up the...
3
by: ryan.mclean | last post by:
Hello everyone, I am wondering, can the membership provider be changed at runtime? Perhaps the connectionStringName? I would like to use a different database based on the server the site is...
4
by: thomas | last post by:
Hello All, How to change the default Membership Provider during the runtime? I know I can reference any provider I want, e.g.: provider = Membership.Providers but the question is how to...
0
by: jwallis | last post by:
I have two systems, one for 'Test' and one for 'Live' and each has a Sql Server. When 'Test' code is published to 'Live' I currently have to edit connection strings in web.config to ensure that...
1
by: Sankalp | last post by:
Hi, I am using VB 2005. My application has many data bound controls. The connection is stored in the app.config file. I want the application to start with a default connection string and while...
1
by: Ben | last post by:
Hi, When an anonymous user has created an new account (with the CreateUserWizard control), i want to let asp.net generate a password and to send it to the address of the email provided by the...
0
by: andremc | last post by:
Hello everyone, I've looked around, but haven't been able to get an exact answer to this question. I have three user roles which have access to their own folders, and an owner role which can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.