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

  • Home
  • SEARCH
  • 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 933687
In Process

The Archive Base Latest Questions

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

Is there a way to disable ASP.Net membership provider from using a web.config? Currently

  • 0

Is there a way to disable ASP.Net membership provider from using a web.config?

Currently it stores a connection string and a sqlMembershipProvider in a web.config which is not where i’d like it to be.

Thank you

  • 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-15T20:52:30+00:00Added an answer on May 15, 2026 at 8:52 pm

    You can typically use a provider just after calling its default constructor and call Initialize on it. However, it is impossible to use the System.Web.Security.Membership abstraction, without the web.config, because the Membership class is hard-wired to the configuration file. When using the Membership class, it will instantiate types that you configured in the configuration file.

    As I said, when you don’t want to configure it in the configuration file, you can create it in code. This would be a nice approach, especially when you have your own IoC framework (you could see the Membership facade as an IoC implementation just for types deriving from MembershipProvider). Here is an example of how for create a SqlMembershipProvider:

    var configuration = new NameValueCollection();
    
    configuration.Add("name", "SqlProvider");
    configuration.Add("connectionStringName", "SqlServices");
    configuration.Add("applicationName", "MyApplication");
    configuration.Add("enablePasswordRetrieval", "false");
    configuration.Add("enablePasswordReset", "true");
    configuration.Add("requiresQuestionAndAnswer", "true");
    configuration.Add("requiresUniqueEmail", "false");
    configuration.Add("passwordFormat", "Hashed");
    configuration.Add("maxInvalidPasswordAttempts", "5");
    configuration.Add("passwordAttemptWindow", "10");
    
    var provider = new SqlMembershipProvider();
    provider.Initialize("SqlProvider", configuration);
    
    // And here store it in a static field or register it with your
    // favorite IoC container.
    container.RegisterSingle<MembershipProvider>(provider);
    

    Good luck.

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

Sidebar

Related Questions

Is there a way to disable an asp.net dropdown list from the vb code
Is there a way to disable asp.net caching on selected page. It would be
Is there a way to disable the ASP.Net auto-naming? For instance : When I
Is there any way to disable entire form using jQuery after submission?
Is there a way prevent an ASP gridview from always relying on javascript for
I'm using VS2010,C# to develop my ASP.NET web app, I've implemented an internal communication
I'm using asp.net mvc. Everytime I run/compile the program it creates membership and role
I couldn't find something similar in SO. In ASP.NET, is there any way that
Is there a way to disable changing the value of a ComboBox in WPF
Is there a way to disable the Pending Checkins processing which Visual Studio 2008

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.