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 7018859
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:06:24+00:00 2026-05-27T23:06:24+00:00

This my problem. I have 1 and only 1 website for multiple customer. To

  • 0

This my problem. I have 1 and only 1 website for multiple customer. To access to their data, customers use urls like this :
http://customer1.mysite.com
http://customer2.mysite.com
etc

Each customer have a SqlServer instance with their data.

Depends to the URL the website connect to the right sql server instance. This is good.

My issue is about Membership, each instance have is own “membership database”. In my webconfig I configure a dummy section like this :

<membership defaultProvider="MyMembershipProvider">
<providers>
<clear />
<add name="MyMembershipProvider"
type="MapApp.MyMembershipProvider, MyApp"            
enablePasswordRetrieval="true" 
enablePasswordReset="true" 
requiresQuestionAndAnswer="false"
applicationName="/" 
requiresUniqueEmail="false" 
passwordFormat="Encrypted" 
minRequiredPasswordLength="5" 
minRequiredNonalphanumericCharacters="0" 
passwordAttemptWindow="10" 
passwordStrengthRegularExpression="" 
connectionStringName="A_DATABASE" />
</providers>           
</membership>

Also I have a custom Membershipprovider with code like this :

public class MyMembershipProvider : SqlMembershipProvider   
{   
public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)   
{   
    base.Initialize(name, config);   
    // Update the private connection string field in the base class.   
    string connectionString = "my new connection string depdend of the customer"  
    // Set private property of Membership provider.   
    FieldInfo connectionStringField = GetType().BaseType.GetField("_sqlConnectionString", BindingFlags.Instance | BindingFlags.NonPublic);   
                     connectionStringField.SetValue(this, connectionString);   
}   
}  

but is not enough a have some issues like “already instanciate” when I call my custom membership provider.

Someone can help me ? Please…

Sorry for my bad english in this long post

  • 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-27T23:06:26+00:00Added an answer on May 27, 2026 at 11:06 pm

    I think I have the solution but it’s a bit strange.

    In my customMemberShipProvider class I must have an empty constructor even if I never call it. And I need another constructor (with args even if I never use it).

    So this is my code :

    public class myMembershipProvider : SqlMembershipProvider
    {
        public myMembershipProvider()
        {
            //never use
        }
    
        public myMembershipProvider(string dummyArg)
        {
            string configPath = "~/web.config";
            Configuration config = WebConfigurationManager.OpenWebConfiguration(configPath);
            MembershipSection section = (MembershipSection)config.GetSection("system.web/membership");
            ProviderSettingsCollection settings = section.Providers;
            NameValueCollection membershipParams = settings[section.DefaultProvider].Parameters;
            if ((HttpContext.Current.Session != null) && (HttpContext.Current.Session["SubDomainInstanceName"] != null) && (!string.IsNullOrEmpty(HttpContext.Current.Session["SubDomainInstanceName"].ToString())))
            {
                membershipParams.Add("Instance", HttpContext.Current.Session["SubDomainInstanceName"].ToString());
            }
            else
            {
                membershipParams.Add("Instance", "default");
            }
            Initialize(section.DefaultProvider, membershipParams);
        }
    
    
        public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config)
        {
            //need to remove the key before call Initialize method 
            string instance = config["Instance"];
            config.Remove("Instance");
            base.Initialize(name, config);
    
            // Update the private connection string field in the base class.   
            string connectionString = //my specific connectionstring;
            // Set private property of Membership provider.   
            FieldInfo connectionStringField = GetType().BaseType.GetField("_sqlConnectionString", BindingFlags.Instance | BindingFlags.NonPublic);
            connectionStringField.SetValue(this, connectionString);
        }
    

    Regards

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

Sidebar

Related Questions

Ok I have this problem I'm trying to use Jquery to load a partial
I have a website that has multiple languages. The way this is set up
We have a problem here. We need to translate a website into multiple language.
We have a problem affecting the production environment only. We have a VB6/ASP website
I have a website with only home page available through simple HTTP protocol. All
Let's say I have a URL: http://example.com/person/list This website will display a list of
I have a problem with old website. All JavaScript code on it use getElemenById
I'm new to this forum and I have a sticky problem with the website
Consider this problem: I have a program which should fetch (let's say) 100 records
NOTE: I have solved the majority of this problem but have run into a

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.