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);

Questions:

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?

 

Coordinator
Nov 27, 2012 at 6:33 PM

I recommend calling into the InitializeSimpleMembership filter as shown in this code sample: http://mvcmusicstore.codeplex.com/SourceControl/changeset/view/e274968f2827#MvcMusicStore%2fApp_Start%2fAppConfig.cs

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.