PussInBoots
PussInBoots

Reputation: 12323

SimpleMembership confusion: InitializeDatabaseFile is not a member of WebMatrix.WebData.WebSecurity

Has this method been deprecated? Can't find any info in any docs.

This is where I originally found the code:

http://blog.osbornm.com/2010/07/21/using-simplemembership-with-asp.net-webpages/

http://weblogs.asp.net/jgalloway/archive/2012/08/29/simplemembership-membership-providers-universal-providers-and-the-new-asp-net-4-5-web-forms-and-asp-net-mvc-4-templates.aspx

//Set up Simple Membership
WebSecurity.InitializeDatabaseFile(“SecurityDemo.sdf”, “Users”, “UserID”, “Username”, true);

Looks to me it has been replaced with this method?

http://msdn.microsoft.com/en-us/library/gg569134(v=vs.111).aspx

Are these the exact same methods with just a name change?

Upvotes: 1

Views: 760

Answers (1)

Kevin Junghans
Kevin Junghans

Reputation: 17540

Yes, InitializeDatabaseFile has been depreciated for InitializeDatabaseConnection. The main difference is that depreciated method took the database name (in this example an MS SQL Server Compact Edition database), whereas the new method takes the name of the connection string for your database that is defined in the web.config. And it is not limited to the Compact Edition. You can learn more about initializing SimpleMembership in this article on customizing and seeding SimpleMembership.

Upvotes: 2

Related Questions