How to Login and Sign up Pages

This article explains how to create login page along with sign up page.
1. To start with open VWD ,click on the File>New>Web Site from main menu.
2. Select ASP.NET Web Site from template, select language from drop-down menu.
3. Click the browse folder and select folder where you want to create website content.
4. Click Ok
VWD creates new website for you.
This contains Default.aspx, Default.aspx.vb or Default.aspx.cs ,web.config files and empty App_Data Folder.
5. Double-click the Default.aspx in Solution Explorer, this will open Default.aspx in document window
6.Switch to design view.
7. Drag LoginStatus control from Login section of Toolbox and drop it on the content area of Default.aspx
8. Then drag a Login control and drop it above the LoginStatus control, so that it appears above the LoginStatus component.
9. Right-Click the Login Component in document window and select Properties from menu.
10. In Properties grid select CreateUserText and add some text like “Please Sign Up ”
11.Right-click the website path in bold in the Solution Explorer and choose new Item, new template will appear choose Web Form under the heading Visual Studio installed templates .
12. Name it as SignUpPage,make sure Place code in separte file .
13. Click ok.
14.You will see new file SignUpPage.aspx in Solution explorer.
15. Switch to deisgn view of Default.aspx, open Properties panel for Login control, add SignUpPage.aspx Url in CreateUserUrl field, this will add link to SignUpPage in CreateUserText .
16. Create one new page ,name it as HomePage.aspx , open HomePage.aspx and switch to design mode write some text like Welcome to Home Page after login.
17. Click the Default.aspx in document window tab , switch to design view , right-click Login control and open Properties Grid add HomePage.aspx in the DesignationPageUrl text filed, this will redirect to HomePage after successful login.
18. Open SignUpPage by double-clicking it in the Solution explorer.
19. Switch to Design View ,drag the CreateUserWizard from Login section of Toolbox and drop it to the content area of the page.
20.Right-Click the CreateUserWizard and open Properties grid ,add Url of HomePage.aspx in the ContinueDesignationPageurl TextField.
21. Click Cltr+F5 ,you will see Default.aspx page with login control
22. Enter some username and password and click Login button, it will give error message:
Your login attempt was not successful. Please try again.
23. Click on Please Sign Up link to create new user account in SignUpPage
Note: Password should be more than six characters and should contain at least one non-alphanumeric.
24.Fill all the text fields and click Create user button ,you will see message:
Complete
Your account has been successfully created.

26. Click Continue button you will be redirected to HomePage.aspx

27. Click refresh button on the tool bar of Solution Explorer ,you will see ASPNETDB.MDF database is create automatically in the App_Data folder which will keep track/record of the user names, passwords and other entries of the SignUpPage.

Great! You can now create login pages without writing lengthy, clumsy codes.

Sample source code is attached as a Zip file.

Posted in |