Monday, April 12, 2010

What's New in ASP.NET and Web Development



The .NET Framework version 3.5 Service Pack 1 includes enhancements for ASP.NET in targeted areas. Visual Studio 2008 and Microsoft Visual Web Developer Express Edition also include enhancements and new features for improved Web development.

The most significant advances are improved support for developing AJAX-enabled Web sites and support for Language-Integrated Query (LINQ). The advances include new server controls and types, a new object-oriented client type library, and full IntelliSense support in Visual Studio 2008 and Microsoft Visual Web Developer Express Edition for working with ECMAScript (JavaScript or JScript).

The following sections of this topic describe the changes in ASP.NET and Visual Web Developer.

ASP.NET Enhancements in SP1

ASP.NET Enhancements in version 3.5

Visual Web Developer Enhancements

  ASP.NET Enhancements in SP1
The following sections provide information about enhancements and new features in Visual Studio 2008 and Visual Web Developer Express Edition.

Dynamic Data
ASP.NET Dynamic Data is a framework that lets you create data-driven ASP.NET Web applications easily. It does this by automatically discovering the data model at run time and determining UI behavior from it. A scaffolding framework instantly provides a functional Web site for viewing and editing data. This scaffolding can then be easily customized using metadata, templates, or by creating standard ASP.NET pages to override the default behavior. At the same time existing applications can easily integrate pieces of the scaffolding logic with their existing pages.

URL Routing
URL routing in ASP.NET enables you to use URLs that do not have to map to specific files in a Web site. Because the URL does not have to map to a file, you can use URLs in a Web application that are descriptive of the user's action and therefore more easily understood by users. In URL routing, you define URL patterns that contain placeholders for values that are used when you handle URL requests. At run time, the pieces of the URL that follow the application name are parsed into discrete values, based on a URL pattern that you have defined.

EntityDataSource Control
The EntityDataSource control supports data binding scenarios based on the Entity Data Model (EDM). The EDM specification represents data as sets of entities and relationships. The EDM is used by the Entity Framework in object-relational mapping and in other scenarios such as ADO.NET Data Services. Users accustomed to the design-time model of ASP.NET data binding controls will find the programming surface of the EntityDataSource control similar to that of other data source controls.

The EntityDataSource control manages create, read, update, and delete operations with a data source on behalf of data-bound controls on the page. The EntityDataSource works with editable grids, forms with user-controlled sorting and filtering, dually bound drop-down list controls, and master-detail pages. The EntityDataSource control is able to obtain query parameter values from page controls, query parameters appended to the page URI, cookies, and other ASP.NET parameter objects.

New ASP.NET AJAX Extensions
The new extensions for ASP.NET AJAX in SP1 give you more control over browser history when you use the Back button. They also enable multiple client scripts to be automatically combined into one composite script. This speeds script load time by greatly reducing the required number of round trips to the server.

JScript Formatting
Code formatting capabilities has been extended to support JScript in Visual Studio and Visual Web Developer Express Edition. You can choose to format code manually for a document or selection, or to be automatically formatted as you type.

  ASP.NET Enhancements in version 3.5
The .NET Framework version 3.5 includes enhancements for ASP.NET in the following areas:

New server controls, types, and a client-script library that work together to enable you to develop AJAX-style Web applications.

Extension of server-based forms authentication, roles management, and profile services as Web services that can be consumed by Web-based applications.

A new EntityDataSource control that exposes the Entity Data Model through the ASP.NET data source control architecture.

A new ListView data control that displays data and that provides a highly customizable UI.

A new LinqDataSource control that exposes Language-Integrated Query (LINQ) through the ASP.NET data source control architecture.

A new merge tool (Aspnet_merge.exe) that merges precompiled assemblies to support flexible deployment and release management. This feature is not available in Visual Web Developer Express Edition.

The .NET Framework version 3.5 is also integrated with IIS 7.0. You can now use ASP.NET services such as forms authentication and caching for all content types, not just ASP.NET Web pages (.aspx files). This is because ASP.NET and IIS 7.0 use the same request pipeline. The unified request processing pipeline means that you can use managed code to develop HTTP pipeline modules that work with all requests in IIS. In addition, IIS and ASP.NET modules and handlers now support unified configuration. For more information, see ASP.NET Application Life Cycle Overview for IIS 7.0.

AJAX Development
The .NET Framework version 3.5 enables you to create Web applications that feature next-generation user interfaces with reusable client components. You can develop Web pages by using a server-based approach, a client-based approach, or a combination of both, according to your requirements. The AJAX server-based and client-based programming models feature the following:

Server controls that support server-based AJAX development. This includes the ScriptManager, UpdatePanel, UpdateProgress, and Timer controls. These controls enable you to create rich client behavior with little or no client script, such as partial-page rendering and displaying update progress during asynchronous postbacks.

The Microsoft AJAX Library, which supports client-based, object-oriented development that is browser independent. In addition to supporting the new AJAX-enabled server controls, the client library enables you to develop custom client components that extend DOM elements or that represent a DOM element.

Server classes that enable you to develop server controls that map to custom client components whose events and properties are set declaratively. Server types that support this functionality include controls that derive from the ExtenderControl or ScriptControl base classes, or that implement the IExtenderControl or IScriptControl interfaces.

Support for script globalization and localization by using client script. Globalization enables you to display dates and numbers based on a culture value (locale). Localization enables you to specify localized content (text, images, and so on) in client components for UI elements or exception messages.

Access to Web services and to ASP.NET authentication, roles management, and profile application services.

The .NET Framework version 3.5 enables you to easily enable asynchronous partial-page updates in a page, which avoids the overhead of full-page postbacks. You can just put existing controls and markup inside UpdatePanel controls. Postbacks from inside an UpdatePanel control become asynchronous postbacks and refresh only the part of the page that is inside the panel, which creates a more fluid user experience. You can display the progress of the partial-page update by using UpdateProgress controls.

Learning About AJAX Development in ASP.NET
The documentation provides extensive information to help you learn how to develop AJAX-style Web applications in ASP.NET. To start, follow the sequence of topics described in Adding AJAX and Client Capabilities Roadmap.

Web Services and Application Services
The .NET Framework version 3.5 enables you to create both ASP.NET (.asmx) and WCF-based Web services that you can call from Web pages in client script by using the Microsoft AJAX Library. You can also call server-based application services that are exposed as Web services, which includes forms authentication, roles management, and profiles. These application services can be consumed in WCF-compatible applications, which includes AJAX-enabled Web pages and Window Forms clients. As a result, applications that are built with these ASP.NET or WCF technologies can share information that is made available by application services. For more information, see Web Services in ASP.NET AJAX and Using ASP.NET Web Services.

ListView Data Control
The ListView control combines many aspects of existing data controls. The ListView control is useful for displaying data in any repeating structure, similar to the DataList and Repeater controls. Unlike those controls, the ListView control supports edit, insert, and delete operations as well as sorting and paging. The paging functionality is provided for ListView by the new DataPager control.

The ListView control is a highly customizable control that enables you to use templates and styles to define the control's UI. Like the Repeater, DataList, and FormView controls, templates in the ListView control are not predefined to render specific UI in the browser. For more information, see ListView Web Server Control Overview.

DataPager Control
The DataPager control is used to page through data that is displayed by a control that implements the IPageableItemContainer interface, such as the ListView control. The DataPager control supports built-in paging UI. You can specify the paging UI by using the NumericPagerField object, which lets users select a page by page number. You can also use the NextPreviousPagerField object, which lets users navigate through pages one page at a time, or to jump to the first or last page. Alternatively, you can create custom paging UI by using the TemplatePagerField object.

LinqDataSource Control
The LinqDataSource control exposes Language Integrated Query (LINQ) through the ASP.NET data source control architecture. You use the LinqDataSource control when you are creating a Web page that retrieves or modifies data and you want to use the programming model that is provided by LINQ. You can simplify the code in a Web page by enabling the LinqDataSource control to automatically create the commands for interacting with the data. By using the LinqDataSource control, you can reduce the amount of code that you must write to perform data operations when compared to performing the same operations in the SqlDataSource control or the ObjectDataSource control. When you use the LinqDataSource control, you also benefit by learning only one programming model to interact with different types of data sources.

You can use declarative markup to create a LinqDataSource control that connects to data from either a database or a data collection such as a collection. In the markup, you can specify the criteria for displaying, filtering, ordering, and grouping data. When the data source is an SQL database table, you can also configure a LinqDataSource control to update, insert, and delete data. You do not have to write the SQL commands to perform these tasks. The LinqDataSource class provides an event model that enables you to customize display and update behavior. For more information, see LinqDataSource Web Server Control Overview.

ASP.NET Merge Tool
The ASP.NET merge tool (Aspnet_merge.exe) lets you combine and manage assemblies that are created by the ASP.NET pre-compilation tool (Aspnet_compiler.exe). (The merge tool was released earlier as an add-on for Visual Studio 2005,) The merge tool creates single assemblies for the site. You can create an assembly for the whole Web site, for each Web site folder, or for just the files that make up the Web site UI (pages and controls).

Note:
This feature is not available in Visual Web Developer Express Edition.


For more information, see ASP.NET Merge Tool (Aspnet_merge.exe). For more information about the ASP.NET compiler tool, see ASP.NET Compilation Tool (Aspnet_compiler.exe).

  Visual Web Developer Enhancements
The following sections provide information about enhancements and new features in Visual Studio 2008 and Visual Web Developer Express Edition.

New Design View and CSS Design Tools
The Web page designer now lets you work in Design view, Source view, or Split view, which displays Design view and Source view at the same time.

Visual Studio now provides tools that make it easy to work with cascading style sheets (CSS). You can design the layout and style content in Design view by using new UI tools such as the CSS Properties window. You can also change positioning, padding, and margins directly in Design view by using WYSIWYG visual-layout tools.

For more information, see the following topics:

Working with CSS Overview

Walkthrough: Creating and Modifying a CSS File

IntelliSense for JScript and ASP.NET AJAX
Visual Studio 2008 and Visual Web Developer Express Edition now offer significantly improved IntelliSense for coding in ECMAScript (JScript or JavaScript), and for writing client script for AJAX-style Web applications that use the Microsoft AJAX Library. IntelliSense is available for client script in script elements and for referenced .js script files. 

Additionally, IntelliSense displays XML code comments. XML code comments are used to describe the summary, parameter, and return details of your client script. ASP.NET AJAX also uses XML code comments to provide IntelliSense for ASP.NET AJAX types and members. IntelliSense is also supported for external script file references that use XML code comments.

For more information, see the following topics:

JScript IntelliSense Overview

Walkthrough: JScript IntelliSense

Web Application Projects
Web applications projects, released earlier as an add-on for Visual Studio 2005, are now integrated into Visual Studio and By using the Web application project model, you can compile a Web site into a single assembly in the Bin folder and explicitly define project resources.

The Web application project model uses the same project, build, and compilation semantics as Web projects in Visual Studio .NET 2003. This enables you to easily migrate Visual Studio .NET 2003 Web sites to the current version of Visual Studio or Visual Web Developer Express Edition.

Web application projects do not replace the Web site project type introduced in Visual Studio 2005. Instead, they provide another project model to provide more options for how you deploy and maintain Web applications.

For more information, see the following topics:

Web Application Projects Overview

How to: Create New Web Application Projects

Multi-targeting Web Applications
Visual Studio now enables you to target a Web application to a specific version of the .NET Framework. You can use one instance of the Visual Studio to develop Web applications for .NET Framework versions 2.0, 3.0 (Windows Vista), and 3.5. In Visual Web Developer Express Edition, you can only create applications that target the 3.5 version of the .NET Framework. However, you can later change the .NET Framework to target versions 2.0, 3.0, and 3.5 by changing the related project property.

For more information, see the following topics:

.NET Framework Multi-Targeting Overview

How to: Target a Specific .NET Framework

Designer and IntelliSense Support for LINQ
A new set of features in Visual Studio 2008 support Language-Integrated Query (LINQ) and extend the powerful query capabilities into the language syntax of C# and Visual Basic. LINQ introduces standard, easily-learned patterns for querying and transforming data, and can be extended to support any kind of data source. The designer provides a visual representation of data classes that enables you to quickly create and edit classes that map to objects in a database. IntelliSense support provides information for LINQ language syntax and for using the LinqDataSource control in Source view. For more information, see LinqDataSource Web Server Control Overview

Support for Creating and Consuming WCF Services in a Web Project
In Visual Studio, you can add ASP.NET Web services (.asmx files) and WCF Web services (.svc files) to a project. Client applications that are written in managed code typically access these Web services through a proxy class. For example, these applications use the proxy class that Visual Studio generates when you use the Add Web Reference dialog box. AJAX applications can access Web services from the browser by using proxy classes that are automatically generated in client script. For more information, see ASP.NET Application Services Overview.

Support for ASP.NET AJAX Extender Controls
AJAX extender controls enhance the client capabilities of standard Web server controls in ASP.NET Web applications. You can provide a richer Web-based user experience by binding one or more extenders to Web server controls such as TextBox controls, Button controls, and Panel controls.

Visual Studio supports all ASP.NET AJAX extender controls. This includes extender controls that you create and those that you add from sources such as the ASP.NET AJAX Control Toolkit, which is available on the ASP.NET Web site.