http://www.developer.com/net/asp/article.php/3099171/Check-Out-The-ASPNET-20-Whidbey-Features.htm
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. Now with ASP.NET 2.0 (code-named Whidbey), Microsoft increased the bar to a much higher level by providing excellent features out-of-the-box that are targeted towards reducing the code required for building Web applications. 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 easy administration and management of the platform, an extensible platform that can be easily customized to meet the requirements of any enterprise, increased performance, and so on. In this article, I will present you with the features of this new improved platform and to help you understand how you can use it to design, develop, and deploy enterprise-class Web applications. We will start off our discussion by taking a look at the changes to the ASP.NET Page architecture. One of the significant improvements in ASP.NET 2.0 is the support for Single-Page architecture. This means that any Web page that you create can contain the server-side logic in the same page itself, instead of storing it in a separate .aspx.vb or .aspx.cs file, as is the case with current .NET version. 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. This makes it possible for you to resort to the "Just Hit Save" programming model (as similar to ASP) wherein you just develop the page and test the page without having to compile it. As mentioned before, by default, ASP.NET Web pages and code files are compiled dynamically when a first request is made to the page. After the initial compilation, the compiled page is cached; the cache is used to satisfy the subsequent requests for the same page. Even though this approach is flexible, you should note that that when the page is requested for the first time, it requires a bit of extra time to compile the code. You can avoid this overhead by leveraging a new feature known as Precompilation; by using this feature, you can compile an ASP.NET Web site before making the Web site available to the users. By using Precompilation, you also can catch all the compilation errors before deploying the application onto the production servers. ASP.NET 2.0 provides the following two options for precompiling a site. 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. Once you isolate the look and feel and standard behavior for all the pages in your application, you can move them to a master page. In the master page, you also add placeholders (known as ContentPlaceHolders) for the content (or child pages) to add their custom content. When users request the content pages, the output of the content pages is merged with the output of the master page, resulting in an output that combines the layout of the master page with the output of the content page. 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. Let us take a look at an example. For the purposes of this example, let us create a new page named MasterPageExample.master and add the following lines of code to it. In the above lines of code, we start by defining a new page directive named master. As the name suggests, this declarative is used to identify that the current page is a master page and prevents the users from requesting the page from a browser. Then, inside the code, we define an element named asp:contentplaceholder, which will be used by all the content pages to render appropriate content that is specific to their pages. Now that we have had a look at the master page, let us look at the content page. To create a content page, let us create a new ASP.NET page named ContentPageExample.aspx and add the following lines of code to it. The code required for the content page is very simple and straightforward. We start by defining the Page directive. As part of the Page directive, we also specify a new attribute named master that is used to identify the name of master page that we want to use. Since we have already created a master page named MasterPageExample.master, we will specify that as the master file. Next, we have an element named content that is used to associate the contentplaceholder element in the master page with the content page. This is done through the use of the contentplaceholderid attribute. That's all that is there to creating a master page and using the master page from a content page. Now, if you request the content page from a browser, you will get the following output. Master pages provide a clean approach for encapsulating the common functionality in a centralized location, allowing other pages to inherit from a single master page, thereby reducing the maintenance of the application. Before ASP.NET 2.0, if you were to reference a reusable component from your ASP.NET application, you had to compile the assembly and place it in the bin folder (or place it in the GAC) of the Web application. But now, 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. Note that you should only put components in the Code subdirectory. There are many times where you would want to allow the users of your Web site to be able to customize the content by selecting, removing, and rearranging the contents of the Web page. Traditionally, implementing this capability required a lot of custom code or you had to depend on third-party products to build a Web site of this nature. To address this shortcoming, ASP.NET 2.0 ships with a Web Parts Framework that provides the infrastructure and the building blocks required for creating modular Web pages that can be easily customized by the users. You can also use Web Parts to create portal pages that aggregate different types of content such as static text, links, and content that can change at runtime. It is also possible for the users to change the layout of the Web parts by dragging and dropping from one place to another, providing a rich user experience. One of the limitations of ASP.NET 1.0 is that it did not provide a declarative model for binding data to data-aware controls such as DataGrid, DataList, and Repeater. Now, in ASP.NET 2.0, you have 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. Before we take a look at this new set of controls, let us understand the theory behind this new declarative model. Binding data to data-aware controls requires the following two steps: ASP.NET 2.0 provides the following data source controls: Apart from the above data source controls, ASP.NET 2.0 also provides the following data-bound controls that you will normally use to display data that is contained in the data source controls: The following example demonstrates how to use the combination of SqlDataSource and GridView controls to retrieve and display data from the Categories table in the Northwind database without writing even a single line of code. In the above code, we start by declaring a button control named btnGet. This control is just used to perform a post-back to the server so that the SQL query can be re-evaluated. Then, we declare a SqlDataSource control named categoriesSource. While declaring the SqlDataSource control, we also specify the ConnectionString and the SQL statement to be executed as attributes. As you can see from the SelectCommand attribute value, we specify a placeholder for the CategoryID parameter by using the @CategoryID identifier. Then, we specify the value for the SQL query parameter by using the SelectParameters template. The combination of ControlId and PropertyName is used to specify the name of the control and the property of the control (that will return the value of the textbox in this case). This allows the category ID entered in the CategoryID textbox to be used as an argument to the SQL query. For the first time, we specify the default value of 1 for the CategoryID by using the defaultvalue property. When you execute the above code, you will see an output that is somewhat similar to the following. By default, when the above page comes up, it displays the details of the category that is identified by CategoryID 1. After that, if you enter a category ID in the textbox and click on Get Category, it will display the details of the category based on the value entered. Some of the advanced features provided by the data controls are as follows: The Cache API introduced with ASP.NET 1.0 was a powerful feature that can be immensely useful in increasing the performance of a Web application. The Cache API also allows you to invalidate items in the cache based on some pre-defined conditions such as change in an XML file, change in another cache item, and so on. By using this feature, you can remove or invalidate an item from the cache when the data or another cached item changes. However, the Cache API in ASP.NET 1.x versions did not provide a mechanism to invalidate an item in the cache when data in a SQL Server database changes. This is a very common capability that many Web applications require.Now, 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. This built-in cache invalidation mechanism works with SQL Server 7.0 and above. However, with SQL Server 7.0 and 2000, only Table-level cache invalidation mechanism is supported. 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. To enable the SQL Server-based cache invalidation mechanism, you need to do the following: By using the above configuration entries, we specify the name of the database in which we want to enable the cache notification mechanism. 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: 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. 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: 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: 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: 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: In this section, we will browse through the remaining important features of ASP.NET 2.0. 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. 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.
# # #
Check Out The ASP.NET 2.0 Whidbey Features!
October 27, 2003
Changes to the Page Architecture
Precompilation
http://localhost/NorthwindWeb/Precompile.axd
This command allows you to precompile the Web site and if there are any compilation errors, they will be displayed in the browser.Use of Master Pages
<%@ master language="C#" %>
<html>
<head runat="server">
<title>Master Page</title>
</head>
<body>
<form runat="server">
This content is from the Master Page from
which the all the pages will be inherited
<br />
<b>
<asp:contentplaceholder id="MiddleContent" runat="server">
</asp:contentplaceholder>
</b>
</form>
</body>
</html>
<%@ page language="c#" master="~/MasterPageExample.master" %>
<script runat="server">
</script>
<asp:content id="Content1" contentplaceholderid="MiddleContent"
runat="server">
This content is from the child page
</asp:content>

Advantages of Master Pages
Sharing Code in the Application
Creating Web Portals Using Web Parts
New Data Controls
<%@ page language="C#" %>
<script runat="server">
</script>
<html>
<head id="Head1" runat="server">
<title>Data Binding using SqlDataSource control</title>
</head>
<body>
<form id="Form1" runat="server">
Enter the Category ID: <asp:textbox id="CategoryID"
runat="server"></asp:textbox>
<asp:button runat="server" id="btnGet" text="Get Category"/>
<asp:sqldatasource id="categoriesSource" runat="server"
connectionstring="server=localhost;database=northwind;
uid=sa;pwd="
selectcommand="SELECT * From Categories
Where CategoryID=@CategoryID">
<SelectParameters>
<asp:ControlParameter defaultvalue="1" Name="CategoryID"
ControlId="CategoryID" PropertyName="Text"/>
</SelectParameters>
</asp:sqldatasource>
<asp:gridview datasourceid="categoriesSource"
runat="server" id="gridCategories">
</asp:gridview>
</form>
</body>
</html>

Advanced Features of Data Controls
Caching Enhancements
<%@ OutputCache duration="3600" varybyparam="none"
sqldependency="Northwind:Employees" %>
<?xml version="1.0"?>
<configuration>
<connectionStrings>
<add name="Northwind"
connectionString="server=localhost;database=Northwind;
UID=sa;PWD="/>
</connectionStrings>
<system.web>
<cache>
<sqlCacheDependency enabled = "true"
pollTime = "1000" >
<databases>
<add name="Northwind"
connectionStringName="Northwind"
pollTime = "1000"/>
</databases>
</sqlCacheDependency>
</cache>
</system.web>
---------
---------
</configuration>
ASP.NET Personalization
Security Enhancements
ASP.NET Themes
<asp:Button runat="server" BackColor="Black"
ForeColor="White" Font-Name="Arial"
Font-Size="10px" />
<%@Page theme="Testheme" %>
Other Features
Conclusion
About the Author