O'Reilly logo

Programming ASP.NET, 3rd Edition by Dan Hurwitz, Jesse Liberty

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

New Features

ASP.NET 2.0 includes a new Web Site Administration Tool that provides a wizard interface for web-site maintenance, as shown in Figure 1-2.

Web Site Application Administration Tool

Figure 1-2. Web Site Application Administration Tool

From within this tool you can establish the database provider both for security and for role management, and you can manage your Application, SMTP, and other site management settings. The web site configuration tool is described fully in Chapter 18.

Special Folders Make Integration Easier

Web sites can now include an App_Code folder immediately below the application root. You may put source code into this folder and it will be compiled automatically every time the web app is run. In addition, an App_Data folder is reserved for databases, and there are additional special folders for XML files, for localization, and for skins and themes (see Chapter 13).

ASP.NET 2.0 takes advantage of the new language feature of "partial classes." In short, this allows VS2005 to separate the tool-generated code from your code, simplifying your tasks and making your code easier to read and maintain.

Security

ASP.NET 2.0 includes a number of controls and scripts that make implementing web-based security far simpler than in previous versions of ASP.NET. The login and related controls are covered in detail in Chapter 11.

Personalization

ASP.NET 2.0 includes a number of controls that allow a user to personalize the web site's user interface, using themes and skins and related controls. These are covered in detail in Chapter 13.

Master Pages

The site developer can easily implement a consistent look and feel across site pages using Master pages that define (relatively) invariant parts of the page. Master pages are covered in Chapter 12.

Navigation

You can provide your user with sophisticated site navigation by defining a site map (usually in an XML file) and then using the new navigation controls (TreeView, SiteMapPath, and so on) to create menus and treeviews. Breadcrumbs can be displayed to help the user see how they reached their current location. The Navigation controls are covered in Chapter 12.

Web Sites Without IIS

When you're working in VS2005, you do not need to have IIS installed, and you can store your entire web site in a folder hierarchy separate from inetpub. This makes sharing development of web sites far easier, and is the technique we use to provide working examples on our support web site that you can download and run or debug immediately.

Improved Controls

All the ASP.NET controls now generate XHTML1.1-compliant markup and support adaptive rendering.

The new datasource controls provide a far simplified interface to data, though you are still free to use the traditional ADO.NET objects. Accessing data is covered in Chapter 9.

You can now group your validation controls to allow different parts of a page to be validated based on state that can be managed programmatically. These new validation features are covered in Chapter 8.

New Controls

ASP.NET 2.0 includes a host of new controls to simplify your coding experience. These controls will be explored in depth throughout this book, but here is a quick overview :

  • Data Access Controls may represent the most significant improvement between ASP.NET 1.x and ASP.NET 2.0. You can bind data to controls on web pages using data source controls that encapsulate connections, commands, and parameters. The source for these controls can be a database, a web service, a business object, a site map, or an XML file. In addition, the ObjectDataSource control allows you to add data access to a page based on an n-tier business object.

  • Complementing the Data Access Controls are a suite of new or improved Data Display Controls, including the GridView, DetailsView, and FormView. Hierarchical data can be displayed in the TreeVew and navigation is supported in the SiteMapPath control.

  • ASP.NET 2.0 provides a complete suite of controls to create web-based security for your application. These include login controls (that prompt the user for credentials and validate them) and the LoginStatus control that manages different views based on if the user is logged in. The LoginView control allows you to constrain access to data and controls to logged in users, and the PasswordRecovery control provides options for helping users recover lost or forgotten passwords.

  • Working closely with the Security controls are the personalization controls that allow you to provide individually personalized views (themes, skins, etc.) to your users. In addition, anonymous personalization is supported to allow you to create, for example, a shopping cart for an anonymous user that is then ported to the user's account when the user does sign in.

Visual Studio 2005 (VS2005)

VS2005 offers numerous improvements over previous versions, including the ability to share configurations across a team, Intellisense in all code windows, including page content files, drag and drop onto code pages as well as design views, support for refactoring and code snippets to speed development, and visualizers to examine complex data in the debugger.

VS2005 sports a new modern tabbed document interface and improved interaction and synchronization between the design and the source view. Code completion has been beefed up considerably as has the context-sensitive help. In addition, many compile errors are flagged immediately even before you try to compile the application. Further, VS2005 will often propose a solution to your compile error, and if you agree, it will implement the fix for you.

Perhaps most important, in VS2005 all .NET languages use the same source code editor, making it far easier to move between C# and Visual Basic and to learn each language.

Mobile Devices

At a recent industry event, it was predicted that by the end of this decade, something like 90 percent of all web traffic would be to small-screen devices, such as wireless PDAs and cell phones. Whether or not you believe this prediction to be accurate, mobile devices comprise a significant part of the web world, and their role will increase.

ASP.NET 1.x did not have any inherent facility for dealing with web sites displayed on mobile devices, as opposed to desktop browsers, other than many classes that supported the .NET Compact Framework for Windows CE .NET. However, none of the classes with a visual component, such as Button and TextBox, supported the Compact Framework.

Many of the visual controls, such as TextBox and Calendar, to name only two, did have equivalent controls in the System.Web.UI.MobileControls namespace. However, this meant that if you wanted to target a conventional desktop browser and a mobile device with the same web site, you had to create two different versions (at least) of the web site, detect which type of device was making the request, then serve the appropriate version.

The previous editions of this book did not include a chapter on mobile devices because the topic seemed more to warrant its own book, of which there are many, rather than a chapter.

Originally ASP.NET 2.0 set out to change all of that. It was going to include a new Display Adapter Architecture, in which there would be only a single set of controls. The Framework would take care of figuring out what type of device or browser was making the request, and render appropriate output. An uplevel desktop browser, such as IE 5 or higher, would get DHTML and script, a downlevel browser would get its appropriate level of HTML and script (as before), and a mobile device would get the correct version of whatever rendering language it preferred, such as WAP. A display adapter layer would intervene between the control and the output rendering, and essentially all visual controls would incorporate this display adapter.

However, Microsoft could not get this new architecture working to their satisfaction in time for the initial release of ASP.NET 2.0 and, to their credit, pulled the mobile rendering adaptors rather than ship substandard software. To develop web sites for mobile devices, you still need to use the controls of the MobileControls namespace. Consequently, this book does not have a chapter on mobile controls.

If Microsoft releases a new version of ASP.NET which incorporates mobile controls more integrally, we will write an additional chapter and post it for download.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required