ASP.NET v 2.0: The Beta Version

Copyright © 2005 by Pearson Education, Inc.

 

 

Dynamic Web page generation techniques have been around for many years, but ASP.NET took the world by storm when it was released in February 2002. The advent of a new page and postback architecture, server controls, and the whole .NET Framework made it easier to build Web sites and Web applications that performed better while reducing the amount of work required by the developer.

 

So, it comes as no surprise to see a new version of .NET, and with it version 2.0 of ASP.NET starting to appear on the horizon. Sometime in late 2004 or early 2005 we should see the final release of version 2.0 of the .NET Framework, together with new versions of Visual Studio and other tools. In the meantime, Microsoft are following their usual policy of involving developers as early in the process as possible, giving them the chance to provide feedback on the new product.

 

So, as the final release of version 2.0 is still some way off, why would you be interested in it now? The simple answer is, of course, that ó as a developer ó you need to keep abreast of what's going on in your industry. And more than that, being aware of what's coming in the future might well influence what you do today, in the overall design of your applications and the preparations and plans you are making for upcoming products and applications.

 

This book will help by introducing you to the new features that will be in version 2.0, and how they can benefit your Web site and Web application development. And it may be that you don't actually intend to install the early releases of version 2.0, but you just want to know more about what it offers. No problem - that's OK with us as well!

 

Versions and Release Schedules

Before you read any further, it's important that you understand what this book covers, and how it relates to the future and final releases of .NET version 2.0.

 

Microsoft is releasing the first public Beta of version 2.0 of the .NET Frameworks in mid 2004. There will probably be another Beta release later in 2004, and followed by a final release. However, there are unlikely to be any significant changes between the first Beta release and the finished product, as this phase of the development cycle concentrates on moving from "code complete" status though fine-tuning and bug fixing to final release.

 

This book covers the first Beta release, and as such the class interface listings and code samples you see here cannot be guaranteed to work in exactly the same way right through to the final release version. However, the principles and general syntax are unlikely to differ by anything more than minor details.

 

What This Book Covers

This is not just a reference book, but instead is a feature-packed exploration of version 2.0 of ASP.NET. It covers the changes between ASP.NET 1.x and ASP.NET 2.0, describing how it makes it even easier to build efficient, attractive and interactive Web sites and Web applications using the new features in ASP.NET, while considerably reducing developer effort and code requirements.

 

The first chapter presents an overview of the new version, and also lays out the roadmap for the remainder of the book. The following chapters discuss how the common requirements of developers have been addressed, starting with the ubiquitous need to access data from your pages; and then progressing through to a detailed look at the new configuration and management features that version 2.0 provides.

 

Along with the final release of .NET 2.0 we will, of course, see a new version of Visual Studio.NET and other tools. While we do include some details of the new Visual Studio .NET, this is not an area that the book concentrates on. Many developers will be writing ASP.NET pages using other tools (including, we suspect, a text editor) while Visual Studio .NET is still under development.

 

What You Need To Use This Book

The main thing you need to use this book is the Beta release of version 2.0 of the .NET Framework release. Other than that, you'll need something to transfer your creative efforts into ASP.NET files on disk. We still prefer a text editor, though early experiments with the new version of Visual Studio .NET suggest that Windows NotePad will soon be seeing the light of day a lot less often in the future. However, it doesn't really matter which tool or editor you use as long as it can generate text files with the .aspx file extension.

 

Finally, you'll need to be prepared to change the way you think about building code for your Web pages, as in many cases you don't actually have to write any code at all in version 2.0. See Chapter 1 for more details, and get ready to be more productive!

 

 

Chapter 1 - An Introduction to ASP.NET 2.0

            Whatís Wrong with ASP.NET 1.x?

            New Features

            Templates for a Consistent Look and Feel

            Styles for Controls

            Securing Your Site

            Personalizing Your Site

            Creating Portals

            Setting Up and Managing Your Site

            Using Images on Your Site

            Using Data on Your Site

            Internationalization

            Adding Mobility Support

            Compilation and Deployment

            Development Tools

            Summary

 

Chapter 2 - Tools and Architecture

            Visual Studio 2005

            Project-less Development

            The Solution Explorer

            The Toolbox

            The Design Window

            The Design Surface

            The Server Explorer

            Visual Inheritance

            Built-in Administration

            Code Separation

            Dynamic Compilation

            New Folders for Dynamic Compilation

            Using the \Code Folder in Visual Studio 2005

            Folder Hierarchy

            Pre-compilation of Applications

            In-place Pre-compilation

            Pre-compilation for Deployment without Source

            Pre-compilation for Deployment with Source

            The Compilation API

            Summary

 

Chapter 3 - Data Source Controls and Data Binding

            Code-Free Data Binding

            Displaying Data with a Data Source Control

            Adding Row Sorting Capabilities

            Adding Row Paging Capabilities

            Built-in Small-Screen and Mobile Device Support

            Linking Page Controls and Data Source Control Parameters

            Editing Data with a GridView and a Data Source Control

            The DetailsView Control

            Data Source Controls

            Types of Data Source Controls

            The SqlDataSource Control

            The AccessDataSource Control

            The Base Classes for the Data Source Controls

            The XmlDataSource Control

            The DataSetDataSource Control

            The ObjectDataSource Control

            Possible Forthcoming Data Source Controls

            Summary

 

Chapter 4 - The GridView,DetailsView,and FormView Controls

            The GridView Control

            An Overview of the GridView Control

            Declaring a GridView Control

            Defining the Columns in a GridView Control

            Using a Mixture of Column Types

            The DetailsView Control

            Using a Stand-Alone DetailsView Control

            Creating a Master-Detail Page with GridView and DetailsView Controls

            Inserting and Editing Rows with a DetailsView Control

            The DetailsView Control Interface

            The FormView Control

            Declaring a FormView Control

            Declaring Templates for a FormView Control

            The New and Simplified Data Binding Syntax

            The ASP.NET 1.0 Syntax for Data Binding

            Simplified ASP.NET 2.0 Syntax for Nonhierarchical Data Binding

            ASP.NET 2.0 Syntax for Hierarchical (XML) Data Binding

            Two-Way Data Binding Syntax for Templated Controls

            New and Simplified Data Binding Syntax Options

            Building Data-Bound Pages with Visual Studio 2005

            Summary

 

Chapter 5 - Master Pages and Navigation

            Master Pages in Detail

            Creating Master Pages

            Using a Master Page

            Default Content

            Nested Master Pages

            Master Page Configuration

            Device-Specific Master Pages

            Event Ordering

            Setting the Master Page Programmatically

            Accessing the Master Page

            Navigation

            Site Maps

            Site Map Providers

            Site Map Configuration Files

            Using a Site Map File

            Site Maps in Depth

            Showing a Navigation Path

            SiteMapPath Events

            The SiteMapNode Object

            Accessing the Site Map at Runtime

            Navigation Controls

            Summary

 

Chapter 6 - Security

            Membership

            Membership Providers

            Setting Up Membership

            Creating a New User

            Validating User Credentials

            Retrieving a User

            The MembershipUser Class

            Updating a Userís Properties

            Deleting a User

            Security Server Controls

            The CreateUserWizard Control

            The Login Control

            The Login Status Control

            The Login View Control

            The Password Recovery Control

            Role Manager

            Setting Up Role Manager

            Creating Roles

            Adding Users to Roles

            Returning a Userís Roles

            Checking whether a User Is in a Role

            Removing Users from Roles

            Deleting a Role

            Role Caching

            Cookieless Forms Authentication

            Enabling Cookieless Forms Authentication

            The Web Site Administration Tool

            The Home Page

            The Security Page

            Security Management

            Other Pages

            Summary

 

Chapter 7 - Personalization and Themes

            Storing and Retrieving User Personalization Data

            Configuring Personalization

            Accessing Other Usersí Personalization Data

            Setting Up the Databases for Personalization

            Data Access Optimizations

            Membership and Personalization

            Anonymous Identification

            Anonymous Personalization

            Migrating from Anonymous to Authenticated Users

            The Provider Design Pattern

            Configuration

            Implementation of the ProviderBase Base Class

            Implementation of the Feature-Specific Interface

            Writing a Personalization Provider

            Configuring Profile Properties

            Themes

            Themes and Skins

            Customization Themes and Stylesheet Themes

            Global Themes

            Creating Themes

            Setting a Page Customization Theme

            Setting a Page Stylesheet Theme

            Setting a Skin

            Applying Skins to All Controls

            Applying Skins to Dynamically Created Controls

            Allowing User Selection of Skins

            Using Personalization for Themes

            Collections of Controls

            Disabling Themes

            Adding Themes to a Site

            Enabling Themes in Custom Controls

            Summary

 

Chapter 8 - Web Parts and the Portal Framework

            The ASP.NET 2.0 Portal Framework

            The Goals of the Portal Framework

            About the Web Parts Framework

            A Simple Web Parts Example Page

            An Overall View of the Example Page

            The Events Zone Declaration

            The Web Part User Control Declarations

            Catalog Zones

            Editor Zones

            Page Design and Web Part Editing

            Help Features for Web Parts

            Connecting Web Parts

            Declaring Static Connections

            Editing Web Part Connections

            Working with Web Parts in Code

            The WebPartManager Class

            The Zone Classes

            The GenericWebPart Class

            Web Parts and Visual Studio 2005

            Summary

 

Chapter 9 - Pages, Posting, Resources and Validation

            Cross-Page Posting

            Posting to Another Page

            Accessing the Previous Page

            Transferring to Another Page in Code

            Detecting Cross-Page Posting

            The Page Life Cycle

            Posting to Another Application

            Validation

            The ValidationGroup Property

            The SetFocusOnError Property

            The ValidateEmptyText Property

            URL Mapping

            Client-Side Script Features

            Registering Script Blocks

            Client Callbacks

            New Form Capabilities

            Form Focus

            Client Click Events

            Submitting Disabled Controls

            Changes to Page Directives

            The Page Directive

            The Master Directive

            The MasterType Directive

            The PreviousPageType Directive

            Changes to Page Headings

            xHTML Compliance The Page and Control Life Cycle

            Site and Page Counters

            Using Site Counters

            Configuring Site and Page Counters

            Resources and Localization

            Code-Free Localization

            What Expression Type to Use, and When?

            User-Selectable Localization

            Programmatic Access of Resources

            Extensibility

            Web Resources

            Summary

 

Chapter 10 - The New Browser and Mobile Device Controls

            Programming for Different Types of Devices

            The Microsoft Mobile Internet Toolkit

            The Unified Control and Adapter Architecture

            Browser Definitions

            The BrowserCapabilities Class

            Page Design and Device Support

            Device Filters

            Summary of the New Controls in ASP.NET 2.0

            Standard Form- and Page-Based Controls

            Rich Controls

            Login and Authentication Controls

            Navigation Controls and Counters

            Data Access and Display Controls

            Mobile Device Controls

            The New Controls in Detail

            New Controls within the HtmlControls Namespace

            The BulletedList Control

            The DynamicImage Control

            The Image Generation Service

            The ImageMap Control

            The FileUpload Control

            The HiddenField Control

            The MultiView and View Controls

            The Wizard Control

            Controls and Attributes Specific to Mobile Devices

            The ContentPager Control

            The PhoneLink Control

            The SoftKeyLabel Attribute

            Mobile Browser Emulators

            Summary

 

Chapter 11 - Enhancements to Existing Controls

            Summary of New Control Features

            Accessibility Improvements

            Input Control Enhancements

            Changes to the Forms and Postback Architecture

            Validation Controls and Validation Groups

            Data Source Control Integration

            Mobile Device Support

            Site and Page Counter Integration

            List Control Enhancements

            Themes Integration

            Tables of Control Enhancements

            Enhancements to Existing Controls in the HtmlControls Namespace

            Enhancements to Existing Controls in the WebControls Namespace

            Details of Individual Control Enhancements

            The AdRotator Control

            The Button, LinkButton, and ImageButton Controls

            The CheckBox Control

            The DataGrid Control

            The HyperLink Control

            The Image Control

            The Label Control

            The List and ListItem Controls

            The Literal Control

            The Panel Control

            The Table, TableHeaderCell, and TableCell Controls

            Summary

 

Chapter 12 - Caching

            Enabling Database Cache Invalidation

            Enabling a Database for SQL Cache Invalidation

            Enabling a Table for SQL Cache Invalidation

            Listing Tables Enabled for SQL Cache Invalidation

            Invalidating the ASP.NET Cache

            Configuration

            Invalidating Output-Cached Pages

            The SqlCacheDependency Class

            Creating SQL Server 7 and 2000 Dependencies

            Creating SQL Server 2005 Dependencies

            The CacheDependency Class

            Summary

 

Chapter 13 - Configuration and Administration

            Application Configuration Files

            Changed Sections

            New Sections

            State Management

            Control State

            Page State Persistence

            Session State Plugability

            The Web Site Administration Tool

            The Management API

            IIS Integration

            Management Classes

            Summary

 

Copyright © 2005 by Pearson Education, Inc.