
- •Contents
- •Introduction
- •Acknowledgments
- •The Goals of ASP.NET 2.0
- •Developer productivity
- •Administration and management
- •Performance and scalability
- •Device-specific code generation
- •Additional New Features of ASP.NET 2.0
- •New developer infrastructures
- •New compilation system
- •Additions to the page framework
- •New objects for accessing data
- •New server controls
- •A New IDE for Building ASP.NET 2.0 Pages
- •The Document Window
- •Views in the Document Window
- •The tag navigator
- •Page tabs
- •Code change status notifications
- •Error notifications and assistance
- •The Toolbox
- •The Solution Explorer
- •Lost Windows
- •Other Common Visual Studio Activities
- •Creating new projects
- •Making references to other objects
- •Using smart tags
- •Saving and importing Visual Studio settings
- •Application Location Options
- •Built-in Web server
- •Web site requiring FrontPage Extensions
- •The ASP.NET Page Structure Options
- •Inline coding
- •New code-behind model
- •New Page Directives
- •New attributes
- •New directives
- •New Page Events
- •Cross-Page Posting
- •New Application Folders
- •\Code folder
- •\Themes folder
- •\Resources folder
- •Compilation
- •The New Data Source Controls
- •The SqlDataSource and GridView Controls
- •Reading data
- •Applying paging in the GridView
- •Sorting rows in the GridView control
- •Defining bound columns in the GridView control
- •Enabling the editing of rows in the GridView control
- •Deleting data from the GridView
- •Dealing with other column types in the GridView
- •Selecting which fields to display in the DetailsView control
- •Using the GridView and DetailsView together
- •Updating, inserting, and deleting rows
- •XmlDataSource Control
- •ObjectDataSource Control
- •SiteMapDataSource Control
- •DataSetDataSource Control
- •Visual Studio 2005
- •Connection Strings
- •Site Maps
- •The PathSeparator property
- •The PathDirection property
- •The ParentLevelsDisplayed property
- •The ShowToolTips property
- •Examining the parts of the TreeView control
- •Binding the TreeView control to an XML file
- •Selecting multiple options in a TreeView
- •Specifying custom icons in the TreeView control
- •Specifying lines used to connect nodes
- •Working with the TreeView control programmatically
- •Applying different styles to the Menu control
- •Menu Events
- •Binding the Menu control to an XML file
- •SiteMap Data Provider
- •SiteMapViewType
- •StartingNodeType
- •SiteMap API
- •Why Do You Need Master Pages?
- •The Basics of Master Pages
- •Coding a Master Page
- •Coding a Content Page
- •Mixing page types and languages
- •Specifying which master page to use
- •Working with the page title
- •Working with controls and properties from the master page
- •Nesting Master Pages
- •Container-Specific Master Pages
- •Event Ordering
- •Caching with Master Pages
- •Using ASP.NET 2.0 Packaged Themes
- •Applying a theme to a single ASP.NET page
- •Applying a theme to an entire application
- •Applying a theme to all applications on a server
- •Removing themes from server controls
- •Removing themes from Web pages
- •Removing themes from applications
- •Creating Your Own Themes
- •Creating the proper folder structure
- •Creating a skin
- •Including CSS files in your themes
- •Having your themes include images
- •Defining Multiple Skin Options
- •Programmatically Working with Themes
- •Themes and Custom Controls
- •Authentication
- •Authorization
- •ASP.NET 2.0 Authentication
- •Setting up your Web site for membership
- •Adding users
- •Asking for credentials
- •Working with authenticated users
- •Showing the number of users online
- •Dealing with passwords
- •ASP.NET 2.0 Authorization
- •Using the LoginView server control
- •Setting up your Web site for role management
- •Adding and retrieving application roles
- •Deleting roles
- •Adding users to roles
- •Getting all the users of a particular role
- •Getting all the roles of a particular user
- •Removing users from roles
- •Checking users in roles
- •Using the Web Site Administration Tool
- •The Personalization Model
- •Adding a simple personalization property
- •Using personalization properties
- •Adding a group of personalization properties
- •Using grouped personalization properties
- •Defining types for personalization properties
- •Using custom types
- •Providing default values
- •Making personalization properties read-only
- •Anonymous Personalization
- •Enabling anonymous identification of the end user
- •Working with anonymous identification events
- •Anonymous options for personalization properties
- •Migrating Anonymous Users
- •Personalization Providers
- •Working with the Access personalization provider
- •Working with the SQL Server personalization provider
- •Using multiple providers
- •Building Dynamic and Modular Web Sites
- •Introducing the WebPartManager control
- •Working with zone layouts
- •Understanding the WebPartZone control
- •Explaining the WebPartPageMenu control
- •Modifying zones
- •Caching in ASP.NET 1.0/1.1
- •Output caching
- •Partial page caching
- •Data caching using the Cache object
- •Cache dependencies
- •ASP.NET 2.0 unseals the CacheDependency class
- •Enabling databases for SQL Server cache invalidation
- •Enabling tables for SQL Server cache invalidation
- •Looking at SQL Server
- •Looking at the tables that are enabled
- •Disabling a table for SQL Server cache invalidation
- •Disabling a database for SQL Server cache invalidation
- •Configuring your ASP.NET Application
- •Adding more than one table to a page
- •Attaching SQL Server cache dependencies to the Request object
- •Attaching SQL Server cache dependencies to the Cache object
- •Customizing the side navigation
- •Examining the AllowReturn attribute
- •Working with the StepType attribute
- •Adding a header to the Wizard control
- •Utilizing Wizard control events
- •Working with images from disk
- •Resizing images
- •Displaying images from streams
- •The MMC ASP.NET Snap-In
- •General
- •Custom Errors
- •Authorization
- •Authentication
- •Application
- •State Management
- •Advanced
- •ASP.NET Web Site Administration Tool
- •Home
- •Security
- •Profile
- •Application
- •Provider
- •Managing the Site Counter System
- •Generics
- •Iterators
- •Anonymous Methods
- •Operator Overloading
- •Visual Basic XML Documentation
- •New Visual Basic Keywords
- •Continue
- •Using
- •Global
- •Index

Administration and Management
Figure 14-11
Again, this dialog provides you with a wealth of available options for modifying how the pages are run in a specific application as well as how your applications, in general, are built and run. The following list briefly describes some of these options:
Common Compilation, Page, and Runtime Settings: This section includes a number of items that are very page-specific. From the first drop-down list, you can select the default language of your application. The available options include all the Microsoft .NET-compliant languages — C#, VB, JS, VJ#, and CPP. Other settings enable you to set the default theme or master page that your ASP.NET pages use during construction.
Globalization Settings: This section allows you to set the default encodings and the cultures for your application.
Identity Settings: The Identity Settings enable you to run the ASP.NET worker-process under a specific user account.
State Management
ASP.NET applications, being stateless in nature, are highly dependent on how state is stored. The sixth tab, the State Management tab (see Figure 14-12), enables you to change a number of different settings that determine how state management is administered.
395

Chapter 14
Figure 14-12
Because you can apply state management to your applications in a number of ways, this dialog allows for a number of different settings — some of which are enabled or disabled based on what is selected. The following list describes some of the available items in this dialog:
Session state mode: This section enables you to determine how the sessions are stored by the ASP.NET application. The default option (shown in Figure 14-12) is InProc. Other options include Off, StateServer, and SQLServer. Running sessions in-process (InProc) means that the sessions are stored in the same process as the ASP.NET worker process. Therefore, if IIS is shut down and then brought up again, all the sessions are destroyed and unavailable to end users. StateServer means that sessions are stored out-of-process by a Windows service called ASPState. SQLServer is by far the most secure way to deal with your sessions@@it stores them directly in SQL Server itself. Although it is the most secure method, it is also the least performance-efficient method.
Cookieless mode: The Cookieless mode section enables you to change how the identifiers for the end user are stored. The default setting uses cookies (UseCookies). Other possible settings include UseUri, AutoDetect, and UseDeviceProfile.
Session timeout: Sessions are only stored for a short period of time before they expire. For years, the default has been 20 minutes. Changing the value here changes how long the sessions created by your application are valid.
396

Administration and Management
Advanced
The last tab, the Advanced tab, is basically a catch-all for all other possible settings in the web.config file. The uppermost drop-down list in the dialog allows you to change the entire page of options. The available sections include
Pages & Tracing
Compilation
Http Handlers
Http Runtime
Locations
Http Modules
Trust
I don’t have room to discuss all of these sections in depth, but I cover some of the more interesting ones in the following paragraphs. Figure 14-13 shows the first option, Pages & Tracing, selected.
Figure 14-13
397

Chapter 14
The Pages & Tracing page lets you determine how the pages are run and traced. You can decide whether smart navigation, view state, response buffering, or request validation is enabled. With tracing, you can set how tracing functions, including whether tracing is used for local requests only, and also how the tracing information is sorted.
The Compilation section of the Advanced tab enables you to define how your ASP.NET pages are compiled. For example, you can define whether Visual Basic’s Option Strict is always enabled or not enabled during the compilation process. You can also specify the local assemblies that are compiled with the application.
The Http Handlers section of the Advanced tab, shown in Figure 14-14, enables you to make modifications to the handlers available for your application. By default, a number of handlers — such as handlers for tracing and the ASP.NET Web Site Administration Tool — are already in place. In this section of the dialog, you can add, edit, or remove handlers.
Figure 14-14
Another Advanced tab option, Http Runtime, is shown in Figure 14-15. This section enables you to set the maximum request length that your application can deal with. By default, this is set at around 4MB, but for security purposes it is always better to lower this number to something that are you still comfortable with. Other options in this dialog enable you to set the minimum number of free threads for new requests, the minimum number of free threads for new local requests, and the application request queue limit.
398