Database Files and ASP.NET Login Controls

I tried the ASP.NET login management guide and everything works fine. However, I do not know how to use the Log-in control for my own database (SQL Server 2005) instead of using the mdf file. I also do not know where this file came from, since it does not appear at all in my solution. We will be very grateful for any literature that I can find in working on a content management system.

+4
source share
2 answers

When you use ASP.NET membership functions, you need to specify a provider. The machine.config file (located in C: \ WINDOWS \ Microsoft.NET \ Framework \ [version] \ CONFIG) specifies the default provider that uses the local .mdf file in the app_data folder. Since you do not want this, you can override it in the web.config application file as follows:

<system.web> <membership defaultProvider="myMembershipProvider"> <providers> <clear /> <!-- remove the default provider since we're not using it anymore --> <add type="System.Web.Security.SqlMembershipProvider" name="myMembershipProvider" connectionStringName="myConnectionString" applicationName="MyApplicationName" /> </providers> </membership> </system.web> 

If you use other features, such as roles, personalization, or profiles, you also need to identify the providers for them in the same way.

Now you need to actually create the database / table on your server. To do this, use C: \ WINDOWS \ Microsoft.NET \ Framework \ [version] \ aspnet_regsql.exe. The connection string for your provider should point to the database that this utility will create for you.

+4
source

Some great links for asp.net login controls:

Sitepoint

MSDN

And asp.net

+1
source

All Articles