I want to create a login system using aspnet_regsql.exe
After the aspnet_regsql.exe
installiation in my SQL Server
, 开发者_运维知识库then what should I do next?
Can someone explain me step by step after the aspnet_regsql.exe
installiation ?
Well, that is a bit too much to write here, but you will find an excellent series of articles here https://web.archive.org/web/20211020202857/http://www.4guysfromrolla.com/articles/120705-1.aspx
Here is a site that explains asp .net authentication - http://www.codeproject.com/KB/aspnet/ASPDOTNETauthentication.aspx
Follow these steps:
After installing aspnet tables on your database goto your web.config file
<connectionStrings>
<add name="UserConnectionString" providerName="System.Data.SqlClient" connectionString="User Id = sa; Password=sqlserver2008; Initial Catalog=UserDATABASE; Data Source = DATA_NET_139\SQLEXPRESS; "/>
</connectionStrings>
In the Membership section add these lines
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="UserConnectionString" applicationName="SampleApplication"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="UserConnectionString" applicationName="SampleApplication"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="UserConnectionString" applicationName="SampleApplication"/>
</providers>
</roleManager>
After this just drag a CreateUserWizar Control to your aspx page and use it. You do not have to write any code for inserting data in to the database asp.net do it automatically.
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server" OnCreatedUser="CreateUserWizard1_CreatedUser">
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
Only change the database name.
精彩评论