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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T00:17:36+00:00 2026-06-13T00:17:36+00:00

I am struggling with getting a simplemembership scenario working in my EntityFramework / MVC4

  • 0

I am struggling with getting a simplemembership scenario working in my EntityFramework / MVC4 / DatabaseFirst project. I’ve found plenty of examples for working with code first, but nothing for DB first.

The problem I’m encountering is the the InitializeDatabaseConnection is throwing an error (“Unable to find the requested .Net Framework Data Provider. It may not be installed.”) The code looks like this :

WebSecurity.InitializeDatabaseConnection("DALEntities", "tblContacts1", "ContactID", "EMail", autoCreateTables: true);

I am not sure what DataProvider is failing. If I try to trace ‘into’ the InitializeDatabaseConnection call, it immediately throws the error.

What am I missing?

Info:
DALEntities is the name of the connectionString that the rest of EF uses. The following code works just fine….

    public ActionResult Test() {
        using (var db = new DALEntities()) {
            var query = from i in db.TBLINVENTORies
                            orderby i.ITEMNAME
                            select i;
            var cnt = query.Count();
            string str = "Total Inventory: " + cnt;
            return Content(str);
        }
    }

My connection strings section from the web.config:

  <connectionStrings>
    <add name="DALEntities" connectionString="metadata=res://*/DAL.DAL.csdl|res://*/DAL.DAL.ssdl|res://*/DAL.DAL.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=SOMECOMPUTER;initial catalog=SOMEDB;persist security info=True;user id=SOMEID;password=SOMEPASS;multipleactiveresultsets=True;App=EntityFramework&quot;" providerName="System.Data.EntityClient" />
  </connectionStrings>

This post seems to be asking the same question (but in context of model-first), but there is no solution yet : Using SimpleMembership with EF model-first

Also, I see that there is an overload for WebSecurity.InitializeDatabaseConnection() with the help text: Initializes the membership system ((blah blah <snip> ProviderName: the name of the ADO.NET data provider. If you want to use Microsoft SQL Server, the WebMatrix.WebData.WebSecurity.InitializeDatabaseConnection(String, String, String, String, Boolean) overload is recommended . I do wish to connect to a MSSQL server…will this be required?

  • 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-06-13T00:17:37+00:00Added an answer on June 13, 2026 at 12:17 am

    The provider giving you trouble is the one specified in your connection string which is System.Data.EntityClient. I suspect the problem is because your project is database-first whereas the simple membership is using code-first. I do not think you can mix these approaches in a single database. Try putting it back to where the DefaultConnection is used for IntializeDatabaseConnection. There should have been a DefaultConnection in your web.config generated by the MVC4 scaffolding. This connection string usually uses System.Data.SqlClient as the provider.

    If you want to keep the simple membership in the database used to store domain information (i.e. DALEntities) then you will need to change your method for using EF on the domain to code-first. If you want to keep your project database-first you need to design your own membership schema in the database and develop custom member and role providers. This is probably the best approach if you are really trying to integrate user information into your domain model.

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

Sidebar

Related Questions

I've been struggling with getting a working regular expression for a little project of
I'm struggling with getting IOC to work in a remoting scenario. I have my
I'm struggling getting the pseudo code for this. Scan string left to right for
I'm struggling with getting a custom attribute / filter working with ninject, constructor injection
I've been struggling with getting an application endpoint working on UCMA 3.0. I am
I am struggling getting Exchange mManagement Shell commands to run in my C# code.
I am trying to learn a bit of AJAX but am struggling with getting
I'm struggling getting some unit tests running and wondering if anyone might have anything
I'm struggling getting my head around the Django's ORM. What I want to do
I am struggling with getting Inno Setup to set the check box to true

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.