views:

79

answers:

1

Can I specify a different database than ASPNETDB using SqlMembershipProvider? I am developing a site on a shared host, and have to restrict my data schema to a single provided database.

I was roundly scolded last time I suggested rolling my own authentication code.

Alternatively, is there some other packaged authentication system I could drop in and configure to use an arbitrary database and tables from asp.net?

+4  A: 

You can install the ASP.Net Membership Schema to any SQL database by using the aspnet_regsql command line tool.

You can also specify any connection string you'd like for your membership provider. Simply add something like this to your membership declaration in your web.config file:

<connectionStrings>
    <add name="MyConnectionString" connectionString="Database=MyDatabase;Server=xxx;User=xxx;Pwd=xxx;" providerName="System.Data.SqlClient"/>

</connectionStrings> 

<membership defaultProvider="MyProvider">
      <providers>
        <add connectionStringName="MyConnectionString" applicationName="/Test"
    description="MyProvider" name="MyProvider" type="SqlMembershipProvider" />
      </providers>
</membership>
womp