Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Using the New Security Controls in ASP.NET 2.0 : Page 2

ASP.NET 2.0 adds many security enhancements to make building Web sites that handle passwords (for example) much easier by providing encryption features in the controls right out of the box.


advertisement
Adding a New User to Your Application
Before you proceed to test the application, you need to create a new user for the application. You can use the ASP.NET Web Site Administration Tool (WAT) to add a new user to your application. To invoke the WAT, select Website and then choose ASP.NET Configuration (see Figure 7). The WAT will be displayed in a new Web page. Click the Security link to go to the Security tab (see Figure 8).

 
Figure 7. Web Site Administration: The figure shows how to invoke the WAT.
 
Figure 8. The WAT: Here's the WAT's user interface.

The Security tab allows you to perform tasks such as creating and deleting users as well as creating roles and access rules for your application. Click on the Create user link to add a new user to your application (see Figure 9). Supply the required information for the new user account (see Figure 10). Note that the password must have a combination of numeric, alphabetical, and special characters. Be sure to supply at least seven characters for the password. Click Create User to add the new user.

 
Figure 9. WAT Security: Selecting the Security tab in the WAT lets you manage security features.
 
Figure 10. Adding Users: The figure shows the WAT security screen where you can add new user accounts.

You are now ready to test the application. Select Default.aspx in Solution Explorer and press F5. Click the Login link to log into the application and then enter the account information. When you have successfully logged into the application, the Login link changes to Logout. Figure 11 shows the sequence of events.
 
Figure 11. Logging In: These three screens illustrate a user's experience while logging in to the application.
Creating New Users
You need to set the ContinueDestinationPageURL property of the CreateUserWizard control so that when the Continue button is clicked the user can be redirected to another page, such as a welcome page.
Besides creating user accounts for users, you can also allow users to create new accounts themselves. This is useful in scenarios where you allow users to create free accounts in order to access your application, such as in a discussion forum.


To allow users to create new accounts, use the CreateUserWizard control. Drag and drop the CreateUserWizard control onto Default.aspx and apply the Colorful scheme. The control should now look like Figure 12. To test the application, press F5. You can now create a new user account yourself (see Figure 13). Supply the needed information and click Create User.

 
Figure 12. The CreateUserWizard Control: The control lets users create their own new user accounts.
 
Figure 13. Self-Created User: The figure shows a user creating a new user account.
 
Figure 14. Account Created: After creating a new account, a user sees this screen.

When the user is created successfully, you will see the screen as shown in Figure 14.


Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap