How to add ASP.NET Membership Provider in a Empty MVC 4 Project Template?

Installing it

You need to add the following Nuget Packages:

Add a reference to

  • System.Transactions

Testing it

Now in order to test it, add the following to the web.config file (Under system.web):

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>

Add the following connection string

  <connectionStrings>
    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=aspnet-UnitTestQueries.UI-20121105001038;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnet-UnitTestQueries.UI-20121105001038.mdf" providerName="System.Data.SqlClient" />
  </connectionStrings>

And what I did was to copy the controllers, models, filters and views from the Internet template and just modify things like the namespace and so on until you get it up and running

This is the result (without styles)

Before login

enter image description here

Registering

enter image description here

Logged IN

enter image description here

Leave a Comment