ASP.NET Overview
ASP.NET is a unified Web development model that includes the services necessary for you to build enterprise-class Web applications with a minimum of coding. ASP.NET is part of the .NET Framework, and when coding ASP.NET applications you have access to classes in the .NET Framework. You can code your applications in any language compatible with the common language runtime (CLR), including Microsoft Visual Basic, C#, JScript .NET, and J#. These languages enable you to develop ASP.NET applications that benefit from the common language runtime, type safety, inheritance, and so on.
ASP.NET includes:
A page and controls framework
The ASP.NET compiler
Security infrastructure
State-management facilities
Application configuration
Health monitoring and performance features
Debugging support
An XML Web services framework
Extensible hosting environment and application life cycle management
An extensible designer environment
Page and Controls Framework
The ASP.NET page and controls framework is a programming framework that runs on a Web server to dynamically produce and render ASP.NET Web pages. ASP.NET Web pages can be requested from any browser or client device, and ASP.NET renders markup (such as HTML) to the requesting browser. As a rule, you can use the same page for multiple browsers, because ASP.NET renders the appropriate markup for the browser making the request. However, you can design your ASP.NET Web page to target a specific browser, such as Microsoft Internet Explorer 6, and take advantage of the features of that browser. ASP.NET supports mobile controls for Web-enabled devices such as cellular phones, handheld computers, and personal digital assistants (PDAs).
ASP.NET Web pages are completely object-oriented. Within ASP.NET Web pages you can work with HTML elements using properties, methods, and events. The ASP.NET page framework removes the implementation details of the separation of client and server inherent in Web-based applications by presenting a unified model for responding to client events in code that runs at the server. The framework also automatically maintains the state of a page and the controls on that page during the page processing life cycle. For more information see ASP.NET Web Pages Overview.
The ASP.NET page and controls framework also enables you to encapsulate common UI functionality in easy-to-use, reusable controls. Controls are written once, can be used in many pages, and are integrated into the ASP.NET Web page that they are placed in during rendering.
The ASP.NET page and controls framework also provides features to control the overall look and feel of your Web site via themes and skins. You can define themes and skins and then apply them at a page level or at a control level. For more information, see ASP.NET Themes and Skins Overview.
In addition to themes, you can define master pages that you use to create a consistent layout for the pages in your application. A single master page defines the layout and standard behavior that you want for all the pages (or a group of pages) in your application. You can then create individual content pages that contain the page-specific content you want to display. When users request the content pages, they merge with the master page to produce output that combines the layout of the master page with the content from the content page. For more information see ASP.NET Master Pages Overview.
ASP.NET Compiler
All ASP.NET code is compiled, which enables strong typing, performance optimizations, and early binding, among other benefits. Once the code has been compiled, the common language runtime further compiles ASP.NET code to native code, providing improved performance.
ASP.NET includes a compiler that will compile all your application components including pages and controls into an assembly that the ASP.NET hosting environment can then use to service user requests. For more information, see ASP.NET Compilation Overview.
Security Infrastructure
In addition to the security features of .NET, ASP.NET provides an advanced security infrastructure for authenticating and authorizing user access as well as performing other security-related tasks. You can authenticate users using Windows authentication supplied by IIS, or you can manage authentication using your own user database using ASP.NET forms authentication and ASP.NET membership. Additionally, you can manage the authorization to the capabilities and information of your Web application using Windows groups or your own custom role database using ASP.NET roles. You can easily remove, add to, or replace these schemes depending upon the needs of your application. For more information see the following topics:
Securing ASP.NET Web Sites
Managing Users by Using Membership
Managing Authorization Using Roles
Forms Authentication Provider
ASP.NET always runs with a particular Windows identity so you can secure your application using Windows capabilities such as NTFS Access Control Lists (ACLs), database permissions, and so on. For more information on the identity of ASP.NET, see Configuring ASP.NET Process Identity and ASP.NET Impersonation.
State-Management Facilities
ASP.NET provides intrinsic state management functionality that enables you to store information between page requests, such as customer information or the contents of a shopping cart. You can save and manage application-specific, session-specific, page-specific, user-specific, and developer-defined information. This information can be independent of any controls on the page.
ASP.NET offers distributed state facilities, which enable you to manage state information across multiple instances of the same application on one computer or on several computers. For more information see ASP.NET State Management Overview.
ASP.NET Configuration
ASP.NET applications use a configuration system that enables you to define configuration settings for your Web server, for a Web site, or for individual applications. You can make configuration settings at the time your ASP.NET applications are deployed and can add or revise configuration settings at any time with minimal impact on operational Web applications and servers. ASP.NET configuration settings are stored in XML-based files. Because these XML files are ASCII text files, it is simple to make configuration changes to your Web applications. You can extend the configuration scheme to suit your requirements. For more information see ASP.NET Configuration Overview.
Health Monitoring and Performance Features
ASP.NET includes features that enable you to monitor health and performance of your ASP.NET application. ASP.NET health monitoring enables reporting of key events that provide information about the health of an application and about error conditions. These events show a combination of diagnostics and monitoring characteristics and offer a high degree of flexibility in terms of what is logged and how it is logged. For more information see ASP.NET Health Monitoring Overview.
ASP.NET supports two groups of performance counters accessible to your applications:
The ASP.NET system performance counter group
The ASP.NET application performance counter group
For more information, see Monitoring ASP.NET Application Performance.
Debugging Support
ASP.NET takes advantage of the run-time debugging infrastructure to provide cross-language and cross-computer debugging support. You can debug both managed and unmanaged objects, as well as all languages supported by the common language runtime and script languages. For details, see ASP.NET Debugging.
In addition, the ASP.NET page framework provides a trace mode that enables you to insert instrumentation messages into your ASP.NET Web pages. For more information see What's New in ASP.NET Tracing.
XML Web Services Framework
ASP.NET supports XML Web services. An XML Web service is a component containing business functionality that enables applications to exchange information across firewalls using standards like HTTP and XML messaging. XML Web services are not tied to a particular component technology or object-calling convention. As a result, programs written in any language, using any component model, and running on any operating system can access XML Web services. For more information, see XML Web Services Using ASP.NET.
Extensible Hosting Environment and Application Life-Cycle Management
ASP.NET includes an extensible hosting environment that controls the life cycle of an application from when a user first accesses a resource (such as a page) in the application to the point at which the application is shut down. While ASP.NET relies on a Web server (IIS) as an application host, ASP.NET provides much of the hosting functionality itself. The architecture of ASP.NET enables you to respond to application events and create custom HTTP handlers and HTTP modules. For more information see ASP.NET Application Life Cycle Overview for IIS 5.0 and 6.0.
Extensible Designer Environment
ASP.NET includes enhanced support for creating designers for Web server controls for use with a visual design tool such as Visual Studio. Designers enable you to build a design-time user interface for a control, so that developers can configure your control's properties and content in the visual design tool. For more information see ASP.NET Control Designers Overview.
Friday, February 22, 2008
What's New in ASP.NET and Web Development
The .NET Framework version 3.5 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
Visual Web Developer Enhancements
ASP.NET Enhancements
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 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.
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 get started, you follow the sequence of topics described in Adding Client Capabilities and AJAX.
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 a SQL database table, you can also configure a LinqDataSource control to update, insert, and delete data. You do no 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).
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. 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.
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.
Note:
Web application projects are not supported in Visual Web Developer Express Edition.
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.
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 Web Services Architectural 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.
Note:
The ASP.NET AJAX Control Toolkit is a community-supported library, and is not supported by Microsoft.
For more information, see the following topics:
ASP.NET AJAX Extender Controls Overview
Walkthrough: ASP.NET AJAX Extender Controls
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
Visual Web Developer Enhancements
ASP.NET Enhancements
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 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.
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 get started, you follow the sequence of topics described in Adding Client Capabilities and AJAX.
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 a SQL database table, you can also configure a LinqDataSource control to update, insert, and delete data. You do no 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).
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. 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.
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.
Note:
Web application projects are not supported in Visual Web Developer Express Edition.
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.
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 Web Services Architectural 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.
Note:
The ASP.NET AJAX Control Toolkit is a community-supported library, and is not supported by Microsoft.
For more information, see the following topics:
ASP.NET AJAX Extender Controls Overview
Walkthrough: ASP.NET AJAX Extender Controls
ASP.NET Site Maps
To use ASP.NET site navigation, you must describe the structure of the site so that the site navigation API and the site navigation controls can expose the site structure properly. By default, the site navigation system uses an XML file that contains the site hierarchy. However, you can also configure the site navigation system to use alternative data sources. For more information, see ASP.NET Site Navigation Providers.
The Web.sitemap File
The simplest way to create a site map is to create an XML file named Web.sitemap that organizes the pages in the site hierarchically. This site map is automatically picked up by the default site-map provider for ASP.NET.
The Web.sitemap file must be located in the application root directory, though it can reference other site-map providers, or other site-map files in other directories as long as those files are in the same application. For more information, see How to: Configure Multiple Site Maps and Site-Map Providers.
Security Note:
Implementing a custom site-map provider that stores site-map data in a file with a file name extension other than .sitemap is a potential security risk. By default, ASP.NET is configured to protect files with known file name extensions — such as .sitemap — from being downloaded by a client. To help protect your data, place any custom site-map data files that have a file name extension other than .sitemap in the App_Data folder. For more information, see Securing ASP.NET Site Navigation.
The following code example shows how the site map might look for a simple site that goes three levels deep. The url attribute can start with the "~/" shortcut which indicates the application root. For more information, see ASP.NET Web Site Paths.
Copy Code
url="~/Products.aspx">
url="~/Hardware.aspx" />
url="~/Software.aspx" />
url="~/Services.aspx">
url="~/Training.aspx" />
url="~/Consulting.aspx" />
url="~/Support.aspx" />
In the Web.sitemap file, add a siteMapNode element for each page in your Web site. Then you can create the hierarchy by nesting siteMapNode elements. In the preceding example, the pages for Hardware and Software are child elements of the Products siteMapNode element. The title attribute defines the text that is usually used as link text, and the description attribute acts both as documentation and as a tool tip in the SiteMapPath control.
Note:
In a site map, you can reference URLs that are outside of your Web application. Access to a URL outside of the application cannot be tested by ASP.NET. Therefore if you enable security trimming, the site-map node will not be visible unless you set the roles attribute to "*", which enables all clients to view the site-map node without first testing access to the URL. For more information, see ASP.NET Site-Map Security Trimming.
Valid Site Maps
A valid site-map file contains only one siteMapNode element that is located immediately under the siteMap element. But the first-level siteMapNode element can contain any number of child siteMapNode elements. Additionally, a valid sitemap file must not have duplicate URLs, though the url attributes can be empty. Providers other than the default site-map provider for ASP.NET might not have this restriction.
Configuring Multiple Site Maps
You can use more than one site-map file or provider to describe the navigation structure of an entire Web site. For example, your root Web.sitemap file can link to a child site-map file by referencing the child site-map file in a siteMapNode element using the following code.
Copy Code
For more information, see How to: Configure Multiple Site Maps and Site-Map Providers.
Localizing Site Maps
You can localize the following properties in a site map.
Title
Description
Custom properties that are contained in the Attributes collection
To localize the Url property, or to define different navigational structures based on a user's locale, you need to define different site-map files for each locale and programmatically switch to the appropriate Provider at run time. For more information, see How to: Programmatically Modify Site-Map Nodes in Memory. For more information about localizing site maps, see How to: Localize Site-Map Data.
The Web.sitemap File
The simplest way to create a site map is to create an XML file named Web.sitemap that organizes the pages in the site hierarchically. This site map is automatically picked up by the default site-map provider for ASP.NET.
The Web.sitemap file must be located in the application root directory, though it can reference other site-map providers, or other site-map files in other directories as long as those files are in the same application. For more information, see How to: Configure Multiple Site Maps and Site-Map Providers.
Security Note:
Implementing a custom site-map provider that stores site-map data in a file with a file name extension other than .sitemap is a potential security risk. By default, ASP.NET is configured to protect files with known file name extensions — such as .sitemap — from being downloaded by a client. To help protect your data, place any custom site-map data files that have a file name extension other than .sitemap in the App_Data folder. For more information, see Securing ASP.NET Site Navigation.
The following code example shows how the site map might look for a simple site that goes three levels deep. The url attribute can start with the "~/" shortcut which indicates the application root. For more information, see ASP.NET Web Site Paths.
Copy Code
In the Web.sitemap file, add a siteMapNode element for each page in your Web site. Then you can create the hierarchy by nesting siteMapNode elements. In the preceding example, the pages for Hardware and Software are child elements of the Products siteMapNode element. The title attribute defines the text that is usually used as link text, and the description attribute acts both as documentation and as a tool tip in the SiteMapPath control.
Note:
In a site map, you can reference URLs that are outside of your Web application. Access to a URL outside of the application cannot be tested by ASP.NET. Therefore if you enable security trimming, the site-map node will not be visible unless you set the roles attribute to "*", which enables all clients to view the site-map node without first testing access to the URL. For more information, see ASP.NET Site-Map Security Trimming.
Valid Site Maps
A valid site-map file contains only one siteMapNode element that is located immediately under the siteMap element. But the first-level siteMapNode element can contain any number of child siteMapNode elements. Additionally, a valid sitemap file must not have duplicate URLs, though the url attributes can be empty. Providers other than the default site-map provider for ASP.NET might not have this restriction.
Configuring Multiple Site Maps
You can use more than one site-map file or provider to describe the navigation structure of an entire Web site. For example, your root Web.sitemap file can link to a child site-map file by referencing the child site-map file in a siteMapNode element using the following code.
Copy Code
For more information, see How to: Configure Multiple Site Maps and Site-Map Providers.
Localizing Site Maps
You can localize the following properties in a site map.
Title
Description
Custom properties that are contained in the Attributes collection
To localize the Url property, or to define different navigational structures based on a user's locale, you need to define different site-map files for each locale and programmatically switch to the appropriate Provider at run time. For more information, see How to: Programmatically Modify Site-Map Nodes in Memory. For more information about localizing site maps, see How to: Localize Site-Map Data.
ASP.NET Site Navigation Overview
.gif)
ASP.NET Site Navigation Overview
You can use ASP.NET site-navigation features to provide a consistent way for users to navigate your site. As your site grows, and as you move pages around in the site, it can become difficult to manage all of the links. ASP.NET site navigation enables you to store links to all of your pages in a central location, and render those links in lists or navigation menus on each page by including a specific Web server control.
To create a consistent, easily managed navigation solution for your site, you can use ASP.NET site navigation. ASP.NET site navigation offers the following features:
Site maps You can use a site map to describe the logical structure of your site. You can then manage page navigation by modifying the site map as pages are added or removed, instead of modifying hyperlinks in all of your Web pages.
ASP.NET controls You can use ASP.NET controls to display navigation menus on your Web pages. The navigation menus are based on the site map.
Programmatic control You can work with ASP.NET site navigation in code to create custom navigation controls or to modify the location of information that is displayed in a navigation menu.
Access rules You can configure access rules that display or hide a link in your navigation menu.
Custom site-map providers You can create custom site-map providers that allow you to work with your own site-map back end (for example, a database where you store link information) and plug your provider into the ASP.NET site-navigation system.
How Site Navigation Works
With ASP.NET site navigation, you describe the layout of your site as a hierarchy. For example, a fictional online computer store might have a site comprised of eight pages, which are laid out in the following manner.
Copy Code
Home
Products
Hardware
Software
Services
Training
Consulting
Support
To use site navigation, start by creating a site map, or a representation of your site. You can describe the hierarchy of your site in an XML file, but other options are also available. For more information and an example, see ASP.NET Site Maps.
After you create a site map, you can display the navigation structure on an ASP.NET page by using a site-navigation control. For an example, see How to: Add Simple Site Navigation.
Site-Map Load Process
The default ASP.NET site-map provider loads site-map data as an XML document and caches it as static data when the application starts. An excessively large site-map file can use a lot of memory and CPU power at load time. The ASP.NET site-navigation features depend on file notifications to keep navigation data up-to-date. When a site-map file is changed, ASP.NET reloads the site-map data. Make sure you configure any virus-scanning software so that it does not modify site-map files. For more information, see Securing ASP.NET Site Navigation.
Site-Navigation Controls
Creating a site map that reflects the structure of your site is one part of the ASP.NET site-navigation system. The other part is to display your navigation structure in your ASP.NET Web pages so that users can move easily around your site. You can easily build navigation into your pages by using the following ASP.NET site-navigation controls:
SiteMapPath This control displays a navigation path — which is also known as a breadcrumb or eyebrow — that shows the user the current page location and displays links as a path back to the home page. The control provides many options for customizing the appearance of the links.
TreeView This control displays a tree structure, or menu, that users can traverse to get to different pages in your site. A node that contains child nodes can be expanded or collapsed by clicking it.
Menu This control displays an expandable menu that users can traverse to get to different pages in your site. A node that contains child nodes is expanded when the cursor hovers over the menu.
If you add a SiteMapPath control to the Training page from the online computer store in the preceding example, the SiteMapPath control will display something like the following, with Home and Services rendered as hyperlinks:
Home > Services > Training
You can use the SiteMapPath control to create site navigation without code and without explicit data binding. The control can read and render the site-map information automatically. However, if necessary, you can also customize the SiteMapPath control with code. For an example, see How to: Programmatically Modify Site-Map Nodes in Memory.
The SiteMapPath control allows users to navigate backward from the current page to pages higher in the site hierarchy. However, the SiteMapPath control does not allow you to navigate forward from the current page to another page deeper in the hierarchy. The SiteMapPath control is useful in newsgroup or message-board applications when users want to see the path to the article that they are browsing.
With the TreeView or Menu controls, users can open nodes and navigate directly to a specific page. These controls do not directly read the site map, as the SiteMapPath control does. Instead, you add a SiteMapDataSource control to a page that can read the site map. You then bind the TreeView or Menu control to the SiteMapDataSource control, resulting in the site map being rendered on the page. The TreeView control will display something like the following:
- Home
- Services
+ Training
Note:
An easy way to display the SiteMapPath, TreeView, or Menu controls on all pages in your site is to create a master page and add the controls to that page. For more information, see ASP.NET Master Pages Overview.
Site-Navigation API
You can use navigation controls to add site navigation to your pages with little or no code, but you can also work with site navigation programmatically. When your Web application runs, ASP.NET exposes a SiteMap object that reflects the site-map structure. All of the members of the SiteMap object are static. The SiteMap object, in turn, exposes a collection of SiteMapNode objects that contain properties for each node in the map. (When you use the SiteMapPath control, the control works with the SiteMap and SiteMapNode objects to render the appropriate links automatically.)
You can use the SiteMap, SiteMapNode, and SiteMapProvider objects in your own code to traverse the site-map structure or create a custom control to display site-map data. You cannot write to the site map, but you can alter site-map nodes in the instance of the object. For more information, see How to: Programmatically Modify Site-Map Nodes in Memory or How to: Programmatically Enumerate Site-Map Nodes.
Relationships Between Site-Navigation Components
The following illustration shows the relationships between the ASP.NET site-navigation components.
Subscribe to:
Posts (Atom)