ASP.NET Whidbey Features


When ASP.NET 1.0 was released, it revolutionized Web application development by providing a rich set of features that were aimed at increasing developers' productivity. The new Version ASP.NET 2.0 (code-named Whidbey) has many improvements that greatly increase developer productivity. These new enhancements arm the developers with a powerful platform that can make a significant impact in the way Web applications are developed and maintained. Apart from increasing the productivity of the developers, ASP.NET 2.0 also provides a number of excellent features, such as Master Pages, Themes, Personalization features and web parts.

This article gives you a peek into many of these new features available in ASP.NET Whidbey.

Page Architecture

One of the significant improvements in ASP.NET 2.0 is the support for Single-Page architecture. The Web page can contain the server-side logic in the same page itself, instead of storing it in a separate .aspx.cs file. The server-side code will be contained in a script block with a runat=server attribute. However, the object model and event model are still the same as in the current code-behind model.

Another important feature is the ability to request a Web form (.aspx file) from a browser without having to compile the code even once. When the page is first requested, ASP.NET compiles the page on the fly, dynamically generating the assembly.

Master Pages

ASP.NET 2.0 introduces a new concept known as Master Pages, in which a common base master file is created to provide a consistent layout for all the pages in your application. Master pages act as a template for all the pages. This quickly allows you to build web forms with consistent look and feel.

Master pages are saved with the file extension .master. Apart from containing all the contents that are required for defining the standard look and feel of the application, the master pages also contain all the top-level HTML elements for a page, such as <html>, <head>, and <form>. The master pages also contain one or more content placeholders that are used to define regions that will be rendered through the content pages.

Master pages also expose an object model that allows you to customize the master page from individual content pages.

Sharing Code in the Application

With ASP.NET 2.0 creating a reusable component is very simple and straightforward. All you need to do is to create the component in a pre-defined subdirectory called Code. Any component placed in this directory will be automatically compiled at runtime into a single assembly. This assembly is automatically referenced and will be available to all the pages in the site. Only Components should be placed in the Code Subdirectory.

Creating Common Page look with Themes and skins

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.

Membership APIs

Providing authentication mechanism is very common requirement for most of the web sites. ASP.NET forms authentication is one of the most common ways of authenticating users. ASP.NET 2.0 introduces membership features using which you can not only authenticate users but also helps in tasks such as create users and managing their passwords. There are new controls such as Login, LoginView, LoginStatus, LoginName, and PasswordRecovery that provide complete control on membership process.

Personalization Features

Many web sites are "community" oriented. Such sites offer individual members to personalize the site based on their choice. Typically you store such personalized information in a database and retrieve it at run time based on logged in user. Settings pertaining to a user is called as its profile. ASP.NET 2.0 provides great way to implement personalization features in your web site.

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.

Web Parts and Web Zones

Taking personalization and customization ahead ASP.NET 2.0 introduces something called as Web Parts. Web Part is a part of the entire web page that can be customized in terms of appearance, position etc. User can choose whether a certain web part to be displayed on the page or not. Web Parts are contained inside Web Part Zones. They together provide modular design to your portals and web sites.

Web Site Pre-compilation

ASP.NET 1.0 compiles the pages on first request and serves future requests with the compiled output. Because of this behavior there is a slight time delay when you execute your pages for the first time. ASP.NET 2.0 has two ways by which you can pre-compile your web site. The first way is via precompiler.axd tool that pre-compiles all the pages and also indicates compile time errors. The another way is to obtain "source code less" copy of your web site via command line tools. The second method converts all the .aspx and other markup pages into assemblies. At run time these assemblies service user requests.

Data Controls

ASP.NET 2.0 provides for a very powerful and easy-to-use declarative model for binding data directly from the database. To this end, ASP.NET 2.0 provides a number of new data-bound controls.

It provides the following data source controls:

  • <asp:SqlDatasource>-This data source control is designed to work with SQL Server, OLE DB, ODBC, and Oracle databases. The control enables you to select, update, delete, and insert data using SQL commands. 

  • <asp:ObjectDatasource>- When you work with an N-tier application, the Middle layer objects may return complex objects that have to be processed in ASP.NET presentation. This new control allows to integrate the data returned from the middle layer objects with the ASP.NET presentation layer. 

  • <asp:AccessDatasource>-This control is designed to work with Access databases. 

  • <asp:XmlDatasource>-This control allows you to bind to XML data, which can come from a variety of sources such as an external XML file, a DataSet object etc. Once the XML data is bound to the XmlDataSource control, this control then can act as a source of data for data-bound controls such as TreeView and Menu. 

  • <asp:DataSetDatasource>-The DataSetDataSource control allows you to easily switch between an XML and a relational view of the data. 

  • <asp:SitemapDatasource>-This control allows the users to navigate between the pages in the Web site. To perform this, you need to create an XML file named app.sitemap that lays out the pages of the site in a hierarchical fashion. Once you have the site hierarchy in the app.sitemap file, you then can data-bind the SitemapDataSource control with the app.sitemap file. After that, the contents of the SitemapDataSource control can be bound to data-aware controls such as TreeView and so on.
    Apart from the above data source controls, ASP.NET 2.0 also provides the following data-bound controls:


  • <asp:gridview>- In a grid view control, each column represents a field, while each row represents a record. You can bind a grid view control to a SqlDataSource control, as well as any data source that implements the System.Collections.IEnumerable interface. This control also can adaptively render data for different types of devices and browsers that are making the request. 

  • <asp:detailsview>-This control can be used in conjunction with the grid view control and can be used to display the details of a specific record in the data source.

Caching Enhancements

With ASP.NET 2.0, Microsoft has introduced a new cache invalidation mechanism that works with SQL Server as well. By using this new capability, you can invalidate an item in the Cache object whenever the data in a SQL Server database changes.

The next release of SQL Server (code-named Yukon) also will feature a row-level cache invalidation mechanism providing a finer level of accuracy over the cached data. notifications, any time data in the table changes, it notifies the ASP.NET to invalidate the specific item in the cache.

Device Support

ASP.NET 2.0 provides a feature called as "adaptive rendering". using this feature ASP.NET 2.0 web pages can emit appropriate markup (such as HTML, XHTML or WML) based on the device accessing the page. This means ASP.NET 2.0 has functionality of MMIT built-in core platform itself. You need not use different markup for different devices.

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 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.

Conclusion

ASP.NET 2.0 provides a number of new productivity enhancements for the developers to be excited about. There are improvements in almost all the areas as compared to ASP.NET 1.0. The rich set of tools and techniques will result in quick development of Web applications and better developer productivity.


Similar Articles