WebSecurity.InitializeDatabaseConnection Method
Include Protected Members
Include Inherited Members
Initializes the membership system by connecting to a database that contains user information.
This member is overloaded. For complete information about this member, including syntax, usage, and examples, click a name in the overload list.
Overload List
Name | Description | |
---|---|---|
InitializeDatabaseConnection(String, String, String, String, Boolean) | Initializes the membership system by connecting to a database that contains user information and optionally creates membership tables if they do not already exist. | |
InitializeDatabaseConnection(String, String, String, String, Boolean, SimpleMembershipProviderCasingBehavior) | ||
InitializeDatabaseConnection(String, String, String, String, String, Boolean) | Initializes the membership system by connecting to a database that contains user information by using the specified membership or role provider, and optionally creates membership tables if they do not already exist. | |
InitializeDatabaseConnection(String, String, String, String, String, Boolean, SimpleMembershipProviderCasingBehavior) |
Top
Remarks
Call this method at application start (in the _AppStart.cshtml or _AppStart.vbhtml file) in order to initialize the simple membership system. This method verifies that the membership database exists. It also opens a connection to the user profile table and establishes a database relationship between the membership data and the user profile data.
If you want to use a database table that contains user profile information (user names, email addresses, and so on), you specify a connection string and table name that the membership system uses to connect to that information. If you do not want to use an existing user profile table, you can specify that the InitializeDatabaseConnection() method should automatically create the user profile table. (A database for the user profile table must already exist.)
Note
If you do not want to use the WebSecurity class to manage membership functionality for your site, do not call the InitializeDatabaseConnection() method. For more information, see the WebSecurity class overview.