开发者

Can you use ASP.NET membership in your own database?

Is there another (preferable simpler) way of including membership tables in your own database other than writing your own开发者_如何学编程 provider?


Of course you can deploy the MS membership provider into whatever database you like (provided that it uses SQL Server). You can use the command-line tool aspnet_regsql.exe (located in the framework folder) to create the tables and procedures used by the membership provider. You won't be able to use your own tables without changing the either the stored procedures or writing your own provider but you can extend the tables (for example adding foreign keys to the users table or adding columns).

I believe you can setup a connection string in the web.config and deploy the tables via web interface but I'm not entirely sure about that. However I am absolutely sure that once deployed you can tweak your existing database with the web tool if you setup the connection string.


You can do that simply by editing the web.config file as follows

<system.web>
....

<membership>
            <providers>
                <clear/>
                <add connectionStringName="yourConnectionStringName" applicationName="YourAppName" minRequiredNonalphanumericCharacters="0" minRequiredPasswordLength="3" requiresQuestionAndAnswer="false" passwordFormat="Clear" name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider"/>
            </providers>
        </membership>

</system.web>

Then run the asp.net configuration or aspnet_regsql.exe

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜