asp.net2.0 new features Overview

Source: Internet
Author: User
Tags define config contains iis implement include new features visual studio

Asp. NET technology from version 1.0 to 1.1 changes are not very large. However, upgrading from 1.x to 2.0 is not an easy task. 2.0 technology adds a lot of new features that are convenient and practical. 2.0 mainly provides the technical features of 3 aspects, such as control, page frame, service and APIs.


In the 1.x era, developers complained about the limited number of built-in server controls and the narrow functionality. In order to eliminate this technical weakness, 2.0 made a breakthrough improvement. In 2.0, new dozens of server controls are added. Depending on the functionality characteristics of the control, it can be divided into: Data controls, including data source controls and data-bound controls, login-series controls, Web Parts, site navigation controls, and other controls. These server controls play an important role in improving productivity and reducing development costs.

Page frame

In terms of the page framework, 2.0 has also made significant improvements, mainly in the following 4 technical features: master pages, themes and skins, compilation mechanisms, and localization. Master page features are widely used in large web sites, to a certain extent, in place of the framework page features, so as to quickly establish a unified layout and appearance of the page, and effectively reduce the strength of the maintenance staff. Themes and skins are a new feature of 2.0, which lets you set one type of server control skin style at a single point. This skin can be easily applied to a single page, an entire Web application, or even an entire server. In the area of application compilation, 2.0 offers several alternatives that broaden the range of compilation choices that developers can make based on specific needs. In addition, 2.0 has also made some improvements in localization.

Services and APIs

This section includes a large proportion of the new features in 2.0, mainly including membership management, role management, user Configuration, data caching, configuration and management tools. With these features, you can quickly implement tasks such as user and role management, personalized user configuration, data caching, and application visualization configuration. Taking membership and role management functions as an example, in the 1.x era, it is tedious and difficult to implement these two functions, while in 2.0 you can easily implement member and role management functions by not only providing a default database table, but simply calling a few simple methods.

One, add new server controls

In the 1.x era, many developers criticized the built-in server controls. The main point is that 1.x offers too few controls to meet growing development needs and to develop applications faster and better. To compensate for the shortfall in 1.x, 2.0 has added dozens of server controls. Depending on the functionality of the control, you can divide it into site navigation controls, data controls (including data source controls and data-bound controls), login series controls, Web Parts, and other server controls. Skilled use of these server controls is important for providing productivity and reducing development costs.

1, Site navigation control

During the 1.x period, Microsoft released a set of IE Web control controls (not built-in controls), which included a TreeView control that implements the tree structure, which is a typical site navigation control. In 2.0, not only contains and extends the original TreeView, but also two additional controls.

The site navigation controls are primarily used to implement Site page navigation functions. Site navigation controls include SiteMapPath, menu, and TreeView controls. The SiteMapPath control can pinpoint the location of the entire Web site where the current page is located based on site navigation information, while using a hierarchical representation method to display location information as an ordered static text or hyperlink. In addition, you can customize the appearance of location information and enable data binding by adjusting related properties. The menu control can build menus similar to Windows applications. The control can be integrated not only with a variety of data source controls, but also with features such as custom skins, event handling, and so on. The TreeView control is primarily used to display a tree structure similar to the tree in Windows Explorer. The control also supports features such as data binding, custom appearance, and so on.

2. Data Control 2.0 data controls can be subdivided into two categories: one for data source controls and the other for data-bound controls. Data source controls include SqlDataSource, AccessDataSource, XmlDataSource, SiteMapDataSource, and ObjectDataSource. These controls primarily implement the ability to connect to different data sources, data retrieval, and modification functions, such as querying, sorting, paging, filtering, updating, deleting, and inserting. Data-bound controls mainly include GridView, DetailsView, and FormView. These controls work with the data source control to display the obtained data in different forms on the page. Because data source controls and data-bound controls support good visual design-time functionality, when you implement data access with Visual Studio 2005, you do not even need to write any code to complete the task.

3. Login Series Control
Many Web sites provide user logon authentication and related features. Common features include user logons, creating new users, and more. Overall, the basic approach to implementing these features is similar, however, because of the level of developer differences, it can cause some unnecessary vulnerabilities and errors. To address this problem, 2.0 integrates the implementation associated with login verification into the Login series control. These controls include: Login, LoginName, LoginView, LoginStatus, PasswordRecovery, ChangePassword, and CreateUserWizard. These controls make it easy to implement logon verification, create new users, display login status, display logon username, update and reset passwords, and more. For flexibility, the login series controls not only provide a large number of member objects, but also support custom template functionality (partial control support). In addition, the login series controls enhance security control. For example, by default, a login Series control works on HTTP on a plain text basis. If your application is concerned about security, you can use HTTPS with SSL encryption.
The login control is used to implement user logon authentication, and the CreateUserWizard control is used to create new users. Perhaps the reader will follow 2.0 before the idea, that the implementation of the above two applications need to add a number of text boxes, buttons and other elements, and design the implementation of database, data access logic. In fact, using login and CreateUserWizard controls to implement the above application is simple enough that you don't need to write any code, you don't need to build your own database, you just add and set the controls.

4. Web Parts
Web Parts are 2.0 new features. If you've ever developed a SharePoint application, you shouldn't be unfamiliar with Web Parts. The Web Parts feature of 2.0 includes multiple server controls, such as WebPartManager that implement WebPart control management and control, EditorZone and EditorPart series controls that implement editing WebPart controls, Implements CatalogZone and CatalogPart series controls for directory management, ConnectionZone controls that implement WebPart communications, and so on. Use them to create highly flexible and personalized web sites.

5, other server controls
In addition to the 4 types of controls described above, 2.0 adds additional server controls. These controls include BulletedList, HiddenField, FileUpload, ImageMap, MultiView (View), and wizard.

Second, master page

Each site should have a unified style and layout. In different technical times, different solutions are given. For example, during the ASP technology period, the #include command was used to primarily use user controls during the 1.x period. 2.0 technical periods, you can use the technical features of the build Page layout framework-Master pages.

A master page is a file with a. master extension whose code content and structure are similar to normal. aspx files. Note that the code includes one or more ContentPlaceHolder controls. When you create a master page, you need to store the public part of the page in the master page, for example, a common page header, footer, and so on, while the non-public part of the page uses the ContentPlaceHolder control to implement the placeholder. Although the content page file has an. aspx extension, the code content and structure are far from the normal. aspx file code, and the code is divided into two parts: one or more content controls are declared on behalf of the dock. Developers need to bind the master page in the content page code header, and also set the non-public parts of the page to be between the content control labels. At run time, a user cannot directly request a master page and can only request access to the content page. At this point, the master page and the content page merge the build results page, which contains the results of the running of both the public and non-public parts of the page.

Iii. Themes and Skins

Before you touch themes and skin features, you may be accustomed to using cascading style sheets (CSS) to set the appearance and style of elements such as pages and controls. While CSS works well in 1.x development, it becomes more difficult to set up CSS if you encounter some complex controls, such as Calendar and GridView. If you can set up the server control entirely based on the control's own appearance and style attributes, not just the elements in the CSS, the entire implementation process will be simpler. The theme and skin function in 2.0 can provide such convenience.

"Subject" refers to the collection of page and control appearance property settings. Topics are made up of a set of files that may include skin files, CSS files, pictures, and other resources. These files must be stored in the App_Themes folder. Skin files are the core of the subject. This file has a. skin extension that contains various property settings for the various server controls. With theme features, you can not only define the appearance of pages and controls, but also quickly and consistently apply a defined look to all Web applications, to all pages of a single Web application, or to a single Web page. In addition, you can dynamically load topics based on your application needs.

Four, personalized User Configuration

Storing and accessing user configuration data has been a hot issue for developers. In the 1.x era, the realization of this function mainly through the session, application and other objects or the use of database storage methods. Both of these methods have their own insurmountable shortcomings. For example, using the former is prone to data loss, while using the latter is cumbersome, such as the need to design and implement the database and the code to access the data. To address these issues, 2.0 has added personalized user Configuration features.

The Personalization User Configuration feature is primarily used to store individual user configuration data, which can be simple data types, complex data types, and even custom objects. At the same time, a single user can be either an anonymous user or a registered user. By default, all user configuration data is stored in the SQL Server database, and the database is not created and maintained by itself, and is automatically completed by 2.0. The personalized User Configuration feature also supports a variety of strongly-typed APIs that are accessed from anywhere in the application to facilitate storage, display, and management of user configuration information. Using the personalized User Configuration feature is simple. First, define the configuration information name, data type, and so on in the Web.config file, and then invoke the strongly typed APIs related to user configuration features, such as profile implementation for storage, access, and management of user configuration information.

V. Membership and role Management

Most of the site's background management includes almost all user members and role management functions, such as creating, modifying, deleting users and roles, setting roles for users, managing users in roles, and so on. When using the 1.x version, the main way to implement these features is to first design a Member library table, a role library table, and so on, and then write code to implement the specific functionality. It may take a lot of time and effort to implement all the features, and the process is cumbersome and prone to errors. However, using 2.0 's new membership and role management features can be a good solution to this problem.

The core of membership and role management capabilities is to implement modular and automated membership and role management models with automatically generated database tables, multiple APIs that implement management capabilities, membership, and role management providers. Specifically, it includes the creation and management of user and role information, the management of user and role information in a variety of data sources, authentication of user credentials to access applications, support for caching role information using cookies, and integration of functions such as role management and membership management.

VI. Configuration and management tools

To quickly and easily implement application configuration and management, 2.0 provides two built-in visualization tools: One is the MMC snap-in and the other is the Web Site Administration tool.

If you have Internet Information Services (IIS) and. NET Framework 2.0 installed on your computer, you can use the mmc snap-in by opening IIS. Use this tool to fully set up the connection string for the specified application, application configuration, custom errors, authorization, authentication, public compilation, page and runtime, globalization and identity, application state, location, and so on. All settings results are displayed in the application Web.config file. From this perspective, the MMC snap-in is a graphical tool for editing web.config files.

If you create a 2.0 application using Visual Studio 2005, you can invoke the Web Site Administration tool. Unlike the MMC management tool, the Web Site Administration tool is a Web application, not a Windows application. The Web Site Administration tool provides a variety of settings for the security, application configuration, and provider of the specified Web application. For example, create administrative user and role information, set SMTP parameters, set up various providers, and so on.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.