February 26, 2021
Hot Topics:

Check Out The ASP.NET 2.0 Whidbey Features!

  • By Thiru Thangarathinam
  • Send Email »
  • More Articles »

ASP.NET Personalization

There are many times when you would want to store and present information that is unique to a user. When a user visits your site, you can use the information that you have already collected from the user to present the user with a personalized version of your Web application. Traditionally, implementing this personalization capability required you to go through the following steps:

  • You must store the information about the user using a unique user identifier. This information is required to recognize the user when they visit again.
  • You need to fetch the user information as needed.
  • Finally, present the user with the personalized content.

To simplify your applications, you can use ASP.NET personalization, which can abstract all of the above complexities from you. In ASP.NET personalization, information about a specific user is stored in a persistent format. ASP.NET personalization allows you to manage user information easily without requiring you to create and maintain your own database. In addition, the personalization system makes the user information available using a consistent, easy-to-use, strongly typed API that you can access from anywhere in your application. You also can store objects of any type in the personalization system, including user information, user preferences, or business information. The personalization system uses a generic storage system for storing the data and makes that data available to the users in a type-safe manner. By default, ASP.NET 2.0 uses SQL Server as the storage mechanism.

Security Enhancements

One of the important security enhancements made in ASP.NET 2.0 is the new role management system that helps you to manage authorization, allowing you to specify the resources that users in your application are allowed to access. ASP.NET Role management system lets you treat groups of users as a unit by assigning users to roles such as manager, sales, member, and so on. In Windows, you create roles by assigning users to groups such as Administrators, Power Users, and so on. After you have established roles, you can create access rules in your application. For example, your site might include a set of pages that you want to display only to members. Similarly, you might want to show or hide a part of a page based on whether the current user is a manager. With roles, you can establish these types of rules independently of individual application users.

In this new role management system, the provider of the roles is completely separated from the role management API. ASP.NET supports the following providers to maintain role information:

  • Access—In this case, role information is stored in a Microsoft Access database and this is the default provider.
  • SQL Server—Here, the role information is stored in a SQL Server database.
  • Windows—In this case, the role information is based on Windows accounts.

ASP.NET provides a number of new controls that are built on top of the ASP.NET role management system. Some of the new controls are as follows:

  • <asp:login>—Provides a standard login capability that allows the users to enter their credentials
  • <asp:loginname>—Displays the name of the logged-in user
  • <asp:loginstatus>—Indicates whether the user is authenticated or not
  • <asp:loginviewv—Provides various login views depending on the selected template
  • <asp:passwordrecovery>—Capability for e-mailing the users their lost password

ASP.NET Themes

Themes are rich skin templates that allow you to define the look of pages and controls, which then can be applied to all the pages in your application, providing a consistent look and feel for the entire application. Themes are extremely flexible in that they can be applied to an entire Web application, to a page, or to an individual control.

Theme files are stored with the extension .skin and all the theme files for a Web application are stored in the special folder named Themes. ASP.NET ships with several themes out of the box. However, it also is possible for you to create custom theme files. To create a custom theme and apply it to a specific page, you need to go through the following steps:

  • Create a file with the extension .skin and add all the controls (that you want to use in a page) and their style properties. Remember to remove the ID attribute in all of the controls. For example, you can use the following code to define the theme for a button control.
    <asp:Button runat="server" BackColor="Black"
                ForeColor="White" Font-Name="Arial"
                Font-Size="10px" />
  • Once you have created the .skin file, you then can apply that theme to all the pages in your application. To apply the theme to a specific page, all you need to do is to add the Theme attribute to the Page directive, as shown below.
    <%@Page theme="Testheme" %>

    It also is possible for you to programmatically access the theme associated with a specific page by using the Page.Theme property. Even though themes are very similar to CSS Style Sheets, they differ from style sheets in the following ways:

    • Themes can define many properties of a control or page, not just a specific set of style properties.
    • Themes can also include external files such as graphics and so on.

Other Features

In this section, we will browse through the remaining important features of ASP.NET 2.0.

  • Within Whidbey, Intellisense (Statement Completion) is now available in the server side <script> blocks. It also is available in <% %> blocks, and in Page directives (starting with the letter @).
  • ASP.NET 2.0 is 64-bit enabled.
  • ASP.NET 2.0 will be almost completely backward compatible with ASP.NET 10.0 and ASP.NET 1.1.
  • ASP.NET 2.0 comes bundled with a built-in development Web server, obviating the need to install IIS.
  • You also can define a single class in multiple files; at runtime they will be compiled together to create a single assembly.
  • With ASP.NET 2.0, you can perform postback across pages, meaning that you can postback from one page to another page. To perform cross-postback when the user clicks a button, set the PostTargetUrl property on the button control to the URL of the new page. From within the new page, you can reference the original page by using the PreviousPage property.
  • In this release, all the <asp:> built-in controls will provide native support for mobile devices, obviating the need to learn a new <mobile:> programming language to program for mobile devices.
  • In the health monitoring space, it will provide support for automated notification when exceptions occur in the Web site. For example, ASP.NET can automatically send an e-mail to the admin when an exception occurs in the Web site.


As you can see, ASP.NET 2.0 provides a number of new productivity enhancements for the developers to be excited about. The features we looked at in this article represent just the tip of the iceberg. But, they should help you get a kick start on this new and feature-rich platform. Once you get familiar with this new platform, you will have a rich set of tools and techniques that can go a long way in making the development of a Web application a breezy experience.

About the Author

Thiru Thangarathinam has six years of experience in architecting, designing, developing, and implementing applications using Object Oriented Application development methodologies. He also possesses a thorough understanding of the software life cycle (design, development, and testing). He holds several certifications, including MCAD for .NET, MCSD, and MCP. Thiru is an expert with ASP.NET, .NET Framework, Visual C# .NET, Visual Basic .NET, ADO.NET, XML Web Services, and .NET Remoting and holds. Thiru has authored numerous books and articles. He can be reached at thiruthangarathinam@yahoo.com.

# # #

Page 3 of 3

This article was originally published on October 27, 2003

Enterprise Development Update

Don't miss an article. Subscribe to our newsletter below.

Thanks for your registration, follow us on our social networks to keep up-to-date