Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 856473
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T08:14:29+00:00 2026-05-15T08:14:29+00:00

I develop an asp.net web application and I use ASP.NET membership provider. The application

  • 0

I develop an asp.net web application and I use ASP.NET membership provider. The application uses the membership schema and all required objects inside main application database
However, during development I have to switch to various databases, for different development and testing scenarios. For this I have an external connection strings section file and also an external appsettings section, which allow me to not change main web.config but switch the db easily, by changing setting only in appsettings section.

My files are as below:

<connectionStrings configSource="connections.config">
</connectionStrings>

<appSettings file="local.config">
    ....

ConnectionStrings looks as usual:

<connectionStrings>
  <add name="MyDB1" connectionString="..." ... />
  <add name="MyDB2" connectionString="..." ... />
  ....
</connectionStrings>

And local.config as below

<appSettings>
    <add key="ConnectionString" value="MyDB2" />

My code takes into account to use this connection string

But membership settings in web.config contains the connection string name directly into the setting, like

<add name="MembershipProvider" connectionStringName="MyDB2" ...>
....
<add name="RoleProvider" connectionStringName="MyDB2" ...>

Because of this, every time I have to edit them too to use the new db.

Is there any way to config membership provider to use an appsetting to select db connection for membership db? Or to “redirect” it to read connection setting from somewhere else? Or at least to have this in some external file (like local.config)

Maybe is some easy way to wrap asp.net membership provider intio my own provider which will just read connection string from where I want and pass it to original membership provider, and then just delegate the whole membership functionality to asp.net membership provider.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T08:14:30+00:00Added an answer on May 15, 2026 at 8:14 am

    I found this solution to create inherited classes and override the Initialize() method to change the connection string. Worked well for me but the web.config settings can be a little tricky. I ended up having to create both a SqlMembershipProvider and a SqlRoleProvider.

    http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/260d8536-c39f-41ec-b181-4d452cf054b3

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to develop a mobile web application using asp.net 3.5 that can be
We are about to develop a web app from scratch using ASP.Net, and would
I am using asp.net MVC to develop an application that will have ajax interactions.
I need to develop a generic jQuery-based search plugin for the ASP.NET MVC application
Im creating a web application in asp.net visual studio 2008.. in my application, i
I develop asp.net websites, and I read about cloud computing, windows azure, etc. But
I want to develop ASP.NET C# based MMOG (Massively multiplayer online game). I would
I'm planning to develop an ASP.NET server control to provide asynchronous username availability validation
I am develop a medium system in ASP.net with MS SQL Server Database and
We are preparing to develop an enterprise Human Resources Project using ASP.NET and our

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.