Introduction:
In this article I will explain how to create users using CreateUserWizard using asp.net membership concept.
Description:
In previous post I explained clearly how to install asp.net membership database schema in SQL Server . After install asp.net membership database check your database everything installed and ready to use in our application or not.
In this article I will explain how to create users using CreateUserWizard using asp.net membership concept.
Description:
In previous post I explained clearly how to install asp.net membership database schema in SQL Server . After install asp.net membership database check your database everything installed and ready to use in our application or not.
Now open visual studio and create new web application after that drag and drop the new control CreateUserWizard from Login Controls section into aspx page and check the aspx page code that would be like this
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Create Users Using CreateUserWizard Control</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">
<WizardSteps>
<asp:CreateUserWizardStep ID="CreateUserWizardStep1" runat="server">
</asp:CreateUserWizardStep>
<asp:CompleteWizardStep ID="CompleteWizardStep1" runat="server">
</asp:CompleteWizardStep>
</WizardSteps>
</asp:CreateUserWizard>
</div>
</form>
</body>
</html>
|
Now open Web.config file and set database connection settings in web.config
First set the connectionstring like this
<connectionStrings>
<add name="dbconnection" connectionString="Data Source=SureshDasari;Initial Catalog=AspMembership;Integrated Security=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
|
After that write the following code in system.web section
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="dbconnection" applicationName="SampleApplication"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="dbconnection" applicationName="SampleApplication"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="dbconnection" applicationName="SampleApplication"/>
</providers>
</roleManager>
|
After that run your application and create users by using CreateUserWizard control.
Here the functionality of insert user details and everything will take care by CreatUserWizard no need to write any coding just set the database and set the conditions in web.config file that is enough it will work perfectly.
During the time of create user if you get error like “Password length minimum: 7. Non-alphanumeric characters required: 1.” check this post solve password length minimum: 7 problem. This problem because of our password basically asp.net membership concept will accept the password only if it contains mixed of alphanumeric and special characters.
Demo
If you observe above demo in that we need to enter different options like UserName, password (strong password like mixed of alphanumeric and special characters), Email (Unique Email), Security Question and answer to register new user.
If we don’t want security question and answer options and we need to allow users to enter his own password without any restrictions for that we need to configure some properties in web.config file like requiresQuestionAndAnswer="false", minRequiredPasswordLength="6" and minRequiredNonalphanumericCharacters="0" to set those properties check this post solve password length problem.
If you enjoyed this post, please support the blog below. It's FREE! Get the latest Asp.net, C#.net, VB.NET, jQuery, Plugins & Code Snippets for FREE by subscribing to our Facebook, Twitter, RSS feed, or by email. |
|||
|
|||
8 comments :
thank you so much it is very helpful
we
after created user account how to go to login page
Sir, its important to know if i am using 3 tire architecture, is it good to use asp.net security controls
hello
Sir I want user registration with confirmation link without using createuserwizard and without click on that link in the mail user not proceed......
means that for complete registration user must click on the link
sir plz help me............
i tried it but it will give me an unhandled exception occurred during the execution of the web request that 'Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion'.
what does it mean?
Note: Only a member of this blog may post a comment.