Database files and ASP.NET Login controls

I was trying the ASP.NET login control tutorial and everything works well. However, I do not know how to have the Log-in control use my own database (SQL Server 2005) instead of using it's mdf file. I also have no idea where this file was created from since it doesn't show up at all on my solution. Any literature that I can find on the workings of the Login control would be greatly appreciated.

Answers


When you use ASP.NET's Membership features, you need to specify a provider. In the machine.config file (which lives in C:\WINDOWS\Microsoft.NET\Framework\[version]\CONFIG) a default provider is specified that uses a local .mdf file in the app_data folder. Since you don't want that, you can override it in your app's web.config file like so:

<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're using other features like roles, personalization, or profiles, you'll need to define providers for them as well in a similar way.

Now you need to actually create the database/tables 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.


Need Your Help

Magento Custom Variable issue

php magento magento-1.8

I am in the process of writing a custom module whereby the user can enter a shipping cost per product.

Eclipse preference page with multiple arrays

java eclipse eclipse-rcp preferences

I tried to search the internet for examples for doing that, but can not find a good one. Also I checking eclipse IDE source code, but it's a bit too big to filter out what I need for an example.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.