What’s New in ASP.NET 2.0
In this tutorial you will learn What’s New in ASP.NET 2.0, New Controls, Master Pages, Site Navigation, User Management, Personilizaiton, Themes and Skins, Mobile Devices, Site Counters, Configuration and Deployment
What’s New in ASP.NET 2.0
The team led by Scott Gurthie focused upon the following enhancements to ASP.NET:
1. Improving Development productivity by reducing the lines of code to be written by 70%. Most of the frequently required code is now available out of the box.
2. Making ASP.NET easier to use with existing devices like Web browsers, PDAs, Cell phones and so on with a potential to connect to new devices that may emerge in the future.
3. Increasing performance and scalability for developing fast web applications platforms by providing facilities such as caching.
4. Simplifying the administration and management of web applications
5. Providing enhanced hosting opportunities for Internet Service providers
6. Ensuring 100% backward compatibility.
The team split the process of enhancement into three parts:–Application services, Page effects and Rich controls. They focused on each of these parts to come up with an application development platform that is exciting and extremely developer friendly.
We shall briefly look at these enhancements in this section.
New Controls
It is expected that the final release of ASP.NET will include 40 new controls. The existing controls will be retained to ensure backward compatibility.
The data controls have received a face lift. The Grid View control has features for sorting, paging, selection and editing of contents out of the box. The communication with the database is transparently handled and is enabled for both reading and writing data to the database.
The DetailsView control displays single records in a vertical listing of data. This control can be configured to provide for custom outputs.
The TreeView control supports the Data Source Provider concept and a number of data sources can be bound to it, including XML data.
The Bulleted list control designed for data binding displays highly configurable HTML lists and provides support for hyperlinks and link buttons.
Apart from the above major new controls a number of other new controls have been introduced to for use of image maps, upload of files and rapid implementation of Wizards.
Master Pages
Master pages have been designed to help web developers design templates with place holders for content. Unlike in the earlier versions of ASP.NET developers can now rely on visual design support to design their pages.
Site Navigation
Implementation of navigation has been made simple with the integrated navigation structure based on XML data. The provider does the job of feeding the navigation structure with data instead of using the site map support. The provider acts as a bridge between the common framework functions and custom implementation.
User Management
An entire user management system is provided out of the box! Extensive API, special controls for registration, login and so on with data providers to handle the data storage without any code are the highlights of this feature. The configuration user management system and the creation of the database is also assisted by a Wizard. The administration feature helps the developer decide how passwords will be stored, reset and so on and also enables the management of user roles.
Personalization
Personalization makes it possible to assign information to an user account, save it to persistent storage and automatically load it back for the next session. This feature can be used in conjunction with the user management system. Complex data structures like shopping carts can also be persisted using XML serialization. The personalization feature also allows users define one or more zones and within the zone information (web parts) can be arranged using drag and drop. This implies that content can be moved, changed or deleted with ease. The Data Provider takes care of the data storage, freeing the developer from designing ways and means of storing data. All data can be stored in SQL Server or Microsoft Access database.
Themes and Skins
With the new ASP.NET allows developers define themes and skins for their applications. The only effort required is the definition of the theme. Some sample themes are included in the standard installation and they can be activated by making some configuration adjustments in the application. The Implementation of themes provides for design properties, CSS support and integration of individual graphics. A theme and a sub theme(called skin) can be local to the application, the page or the control.
Mobile devices
Mobile computing has been taken to new heights with ASP.NET 2.0. Controls for mobile devices included in ASP.NET 1.1 are still available but are not recommended for use. The new ASP.NET introduces the concept of “adaptive rendering” which makes controls redundant. Regular web controls will adapt to the requirements of the target device! A set of adapter classes have been defined and assigned to each control and they are included for common browsers and mobile devices. Customized adapters can also be defined by the developer. This leaves Microsoft with the option to add adapters for new devices that may enter the market in the future.
Site Counters
This feature helps in counting page requests and also clicks of controls (e.g. AdRotator, Button, link button etc). The .NET framework provides an extensive API to analyze, visualize and process the data.
Configuration
The new ASP.NET does away with the cumbersome configuration files of its earlier versions. The voluminous API to read and write configuration files like web.config in type safe manner makes the whole job easier. Each object gets one corresponding configuration segment and a whole collection where necessary. These objects can be edited and then saved back to the file. In the process every setting in the web application can be controlled by the developer. Web Site Administration tools and Configuration Settings Editor are two major additions under this head.
Deployment
ASP.NET 2.0 opens up several new possibilities for the deployment of the applications. Developers can now create or open projects using the file system or the local IIS, FrontPage Extensions or even FTP. The Web Copy Assistant supports the synchronization of local development version with the live server. The new functionality for compiling complete web applications includes copying of Dynamic link Libraries(DLLs) to the Web server. These libraries contain compiled source code and the content of the aspx and ascx files. This implies that no design time files will be required to be placed on the server and hence modification of the application becomes difficult.
Since we propose to use C#.NET as the programming language, let us briefly also have a look at what is new in C#.NET 2005.
The new features of C#.NET are classified into four categories:- Generics, Iterators, Anonymous methods and Partial Classes.
Generics were introduced to enable developers create type safe data structures. They can be defined as utility helper classes that do not commit the developer to the actual data types being used. This feature improves performance and results in higher quality code as the algorithms can be reused without duplicating type specific code. They are an extension to the CLR type system and allow developers to define types which are unspecified. They are then specified at runtime as the code references the generic type and fills in the details, tailoring the type to particular needs. Though generics serve a similar purpose as C++ templates in managed code they have some additional features which include absences of code bloat and developer confusion. Four distinct benefits accrue to the developer at compile time—Type safety, binary code reuse, performance and clarity.
Iterators are used to iterate over data structures such as arrays, collections using a foreach loop. The condition being that the GetEnumerator method is implemented to return an IEnumerator interface. C# 2.0 defines the generic type safe IEnumerable
C#.NET 2.0 supports delegates as means of invoking one or more methods. The Delegates provide operators and methods for adding or removing target methods and are frequently used in .NET Framework for events, callbacks, asynchronous calls and multithreading. Anonymous methods are a new feature in C#.NET 2.0 that lets the developer define an anonymous method called by a delegate. This method is defined inline and is not a member method of any class and there is no way of applying method attributes to it. The anonymous method cannot define generic types or add generic constraints. The compiler has to infer the type of delegate used, instantiate a new delegate object of the inferred type, wrap the new delegate around the anonymous method and assign it to the delegate used in the definition of the anonymous method. Anonymous methods can be used anywhere and can be passed to any method that accepts the appropriate delegate type as a parameter. Anonymous methods can use generic types as parameters.
Partial Classes are classes whose definition and implementation are split into two or more separate files. Every part of the class is marked with the new modifier partial. The compiler then looks for the marked and parts and merges the component parts and merges them into one complete implementation at runtime. A precondition is that the assembly of the code parts must be in the same project and a parallel compilation. The classes also should be matched logically and must have identical modifiers, supported interfaces etc. All attributes assigned at class level are handled automatically. This feature was directed towards rapid application development and probably for distinguishing between generated and custom code.
The new features of Visual Studio.NET 2.0 and its repository of software including ASP.NET, C#.NET etc are dedicated solutions created to address specific problems of the developer. It attempts to simplify the overall programming model. The compiler is designed to generate most of the code and the developer is freed from repetitive programming tasks. Code has become more concise and readable.