This project is read-only.

Simple Membership, WebSecurity.InitializeDatabaseConnection

Nov 27, 2012 at 6:06 PM

Setup for the questions below:

The InitializeSimpleMembershipAttribute.cs filter is a component that comes as part of the MVC 4 Internet Application template.

It already contains the code:

WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);


1. Do I need to alter this default code in any way to get it to work?

2. What does (or should) this code result in?  What am I looking for?


Nov 27, 2012 at 6:33 PM

I recommend calling into the InitializeSimpleMembership filter as shown in this code sample:

This should create a membership database using the default connection (as listed in your web.config file).

The code sample listed above will both create the database and add a default user.