- •Preface
- •Who Should Read This Book
- •Organization and Presentation
- •Contacting the Authors
- •Acknowledgments
- •Contents
- •Introduction
- •Why Microsoft .NET?
- •The Microsoft .NET Architecture
- •Internet Standards
- •The Evolution of ASP
- •The Benefits of ASP.NET
- •What Is .NET?
- •.NET Experiences
- •.NET Clients
- •.NET Services
- •.NET Servers
- •Review
- •Quiz Yourself
- •Installation Requirements
- •Installing ASP.NET and ADO.NET
- •Installing the .NET Framework SDK
- •Testing Your Installation
- •Support for .NET
- •Review
- •Quiz Yourself
- •Designing a Database
- •Normalization of Data
- •Security Considerations
- •Review
- •Quiz Yourself
- •Creating a Database
- •Creating SQL Server Tables
- •Creating a View
- •Creating a Stored Procedure
- •Creating a Trigger
- •Review
- •Quiz Yourself
- •INSERT Statements
- •DELETE Statements
- •UPDATE Statements
- •SELECT Statements
- •Review
- •Quiz Yourself
- •The XML Design Specs
- •The Structure of XML Documents
- •XML Syntax
- •XML and the .NET Framework
- •Review
- •Quiz Yourself
- •ASP.NET Events
- •Page Directives
- •Namespaces
- •Choosing a Language
- •Review
- •Quiz Yourself
- •Introducing HTML Controls
- •Using HTML controls
- •How HTML controls work
- •Intrinsic HTML controls
- •HTML Control Events
- •The Page_OnLoad event
- •Custom event handlers
- •Review
- •Quiz Yourself
- •Intrinsic Controls
- •Using intrinsic controls
- •Handling intrinsic Web control events
- •List Controls
- •Rich Controls
- •Review
- •Quiz Yourself
- •Creating a User Control
- •Adding User Control Properties
- •Writing Custom Control Methods
- •Implementing User Control Events
- •Review
- •Quiz Yourself
- •Common Aspects of Validation Controls
- •Display property
- •Type Property
- •Operator Property
- •Using Validation Controls
- •RequiredFieldValidator
- •RegularExpressionValidator
- •CompareValidator
- •RangeValidator
- •CustomValidator
- •ValidationSummaryx
- •Review
- •Quiz Yourself
- •Maintaining State Out of Process for Scalability
- •No More Cookies but Plenty of Milk!
- •Out of Process State Management
- •Review
- •Quiz Yourself
- •Introducing the Key Security Mechanisms
- •Web.config and Security
- •Special identities
- •Using request types to limit access
- •New Tricks for Forms-based Authentication
- •Using the Passport Authentication Provider
- •Review
- •Quiz Yourself
- •ASP.NET Updates to the ASP Response Model
- •Caching with ASP.NET
- •Page Output Caching
- •Absolute cache expiration
- •Sliding cache expiration
- •Fragment Caching
- •Page Data Caching
- •Expiration
- •File and Key Dependency and Scavenging
- •Review
- •Quiz Yourself
- •A Brief History of Microsoft Data Access
- •Differences between ADO and ADO.NET
- •Transmission formats
- •Connected versus disconnected datasets
- •COM marshaling versus text-based data transmission
- •Variant versus strongly typed data
- •Data schema
- •ADO.NET Managed Provider Versus SQL Managed Provider
- •Review
- •Quiz Yourself
- •Review
- •Quiz Yourself
- •Creating a Connection
- •Opening a Connection
- •Using Transactions
- •Review
- •Quiz Yourself
- •Building a Command
- •Connection property
- •CommandText property
- •CommandType property
- •CommandTimeout property
- •Appending parameters
- •Executing a Command
- •ExecuteNonQuery method
- •Prepare method
- •ExecuteReader method
- •Review
- •Quiz Yourself
- •Introducing DataReaders
- •Using DataReader Properties
- •Item property
- •FieldCount property
- •IsClosed property
- •RecordsAffected property
- •Using DataReader Methods
- •Read method
- •GetValue method
- •Get[Data Type] methods
- •GetOrdinal method
- •GetName method
- •Close method
- •Review
- •Quiz Yourself
- •Constructing a DataAdapter Object
- •SelectCommand property
- •UpdateCommand, DeleteCommand, and InsertCommand properties
- •Fill method
- •Update method
- •Dispose method
- •Using DataSet Objects
- •DataSetName property
- •CaseSensitive property
- •Review
- •Quiz Yourself
- •Constructing a DataSet
- •Tables property
- •TablesCollection Object
- •Count property
- •Item property
- •Contains method
- •CanRemove method
- •Remove method
- •Add method
- •DataTable Objects
- •CaseSensitive property
- •ChildRelations property
- •Columns property
- •Constraints property
- •DataSet property
- •DefaultView property
- •ParentRelations property
- •PrimaryKey property
- •Rows property
- •Dispose method
- •NewRow method
- •Review
- •Quiz Yourself
- •What Is Data Binding?
- •Binding to Arrays and Extended Object Types
- •Binding to Database Data
- •Binding to XML
- •TreeView Control
- •Implement the TreeView server control
- •Review
- •Quiz Yourself
- •DataGrid Control Basics
- •Binding a set of data to a DataGrid control
- •Formatting the output of a DataGrid control
- •Master/Detail Relationships with the DataGrid Control
- •Populating the Master control
- •Filtering the detail listing
- •Review
- •QUIZ YOURSELF
- •Updating Your Data
- •Handling the OnEditCommand Event
- •Handling the OnCancelCommand Event
- •Handling the OnUpdateCommand Event
- •Checking that the user input has been validated
- •Executing the update process
- •Deleting Data with the OnDeleteCommand Event
- •Sorting Columns with the DataGrid Control
- •Review
- •Quiz Yourself
- •What Is Data Shaping?
- •Why Shape Your Data?
- •DataSet Object
- •Shaping Data with the Relations Method
- •Review
- •Quiz Yourself
- •OLEDBError Object Description
- •OLEDBError Object Properties
- •OLEDBError Object Methods
- •OLEDBException Properties
- •Writing Errors to the Event Log
- •Review
- •Quiz Yourself
- •Introducing SOAP
- •Accessing Remote Data with SOAP
- •SOAP Discovery (DISCO)
- •Web Service Description Language (WSDL)
- •Using SOAP with ASP.NET
- •Review
- •Quiz Yourself
- •Developing a Web Service
- •Consuming a Web Service
- •Review
- •Quiz Yourself
- •ASP and ASP.NET Compatibility
- •Scripting language limitations
- •Rendering HTML page elements
- •Using script blocks
- •Syntax differences and language modifications
- •Running ASP Pages under Microsoft.NET
- •Using VB6 Components with ASP.NET
- •Review
- •Quiz Yourself
- •Preparing a Migration Path
- •ADO and ADO.NET Compatibility
- •Running ADO under ASP.NET
- •Early Binding ADO COM Objects in ASP.NET
- •Review
- •Quiz Yourself
- •Answers to Part Reviews
- •Friday Evening Review Answers
- •Saturday Morning Review Answers
- •Saturday Afternoon Review Answers
- •Saturday Evening Review Answers
- •Sunday Morning Review Answers
- •Sunday Afternoon Review Answers
- •What’s on the CD-ROM
- •System Requirements
- •Using the CD with Windows
- •What’s on the CD
- •The Software Directory
- •Troubleshooting
- •ADO.NET Class Descriptions
- •Coding Differences in ASP and ASP.NET
- •Retrieving a Table from a Database
- •Displaying a Table from a Database
- •Variable Declarations
- •Statements
- •Comments
- •Indexed Property Access
- •Using Arrays
- •Initializing Variables
- •If Statements
- •Case Statements
- •For Loops
- •While Loops
- •String Concatenation
- •Error Handling
- •Conversion of Variable Types
- •Index
Session 1—Introducing ASP.NET |
11 |
.NET Tools
Visual Studio .NET and the Microsoft .NET Framework supply a complete solution for developers to build, deploy, and manage Web Services. The .NET Tools maximize the performance, reliability, and security of Web Services.
Visual Studio .NET is the next generation of Microsoft’s multi-language development environment. Visual Studio .NET will help developers quickly build Web Services and applications (including ASP.NET applications) using their language of choice. Visual Studio .NET advances the high-productivity programming languages Visual Basic, which includes new object-oriented programming features; Visual C++, which advances Windows development and enables you to build .NET applications; and C# (pronounced C sharp).
The .NET Framework is a high-productivity, standards-based, multi-language application execution environment that handles the essential “house keeping” chores and eases deployment and management. It provides an application execution environment that manages memory, addresses, versioning issues, and improves the reliability, scalability, and security of applications. The .NET Framework consists of several parts, including the Common Language Runtime and ASP.NET.
REVIEW
ASP is relatively new Web development technology. Although it is very powerful and simple to use, it does has some flaws. With ASP.NET, Microsoft has introduced a new Web development platform that addresses many, if not all, of ASP’s shortcomings. ASP.NET offers many programmatic improvements including a new data access technology called ADO.NET. ADO.NET is designed to work on the Web, which is inherently disconnected. ASP.NET and ADO.NET are part of larger framework, generically referred to as the .NET Framework. The
.NET Framework is a set of products and services designed to facilitate the development of interoperable Web applications based on open standards such as SOAP, XML, and HTTP.
QUIZ YOURSELF
1.What is the function of TCP/IP? (See “Internet Standards.”)
2.What are two problems when developing ASP applications? (See “The Evolution of ASP.”)
3.What are two improvements provided by ASP.NET over ASP? (See “The Benefits of ASP.NET.”)
S E S S I O N
2
Setting Up .NET
Session Checklist
Requirements for ASP.NET and ADO.NET
Installing ASP.NET and ADO.NET
Testing the installation
Before getting too deep into .NET you need to make sure that you have the minimal requirements for the .NET Framework and have successfully installed the software so that you can walk through the samples in this book. This session will cover the minimal
and recommend configurations and give you some pointers for installing and testing the .NET Framework.
Installation Requirements
Before you get started with .NET you should first evaluate the minimum system requirements for the .NET Framework. These include but are not limited to the following:
Windows 98, Windows ME, Windows NT 4.0, Windows 2000, and Windows XP
Internet Explorer 5.01 or higher
Microsoft Data Access Components (MDAC) 2.6 Required, MDAC 2.7 Recommended
IIS 4.0, IIS 5.0 or higher
While the .NET Framework SDK can be installed on the platforms listed above, for developers building ASP.NET solutions, and for you, the reader of this book, there are fewer options. As a server-based component, ASP.NET takes advantage of certain security, threading, and transaction-based functionality that is not compatible with Windows NT 4.0, Windows ME, or Windows 98. Table 2-1 provides an installation matrix covering the mix of solutions recommended by the authors for deploying and developing ASP.NET solutions.
14 |
Friday Evening |
Table 2-1 Recommended Configurations for ASP.NET |
|
|
|||
Operating |
Web |
Database |
Web |
MDAC |
Develop / |
System |
Server |
|
Browser |
|
Deploy |
Windows 2000 |
IIS 5.1 |
SQL Server 2000 |
Internet |
MDAC 2.7 |
Develop |
Professional or |
|
Developer |
Explorer 5.5 |
|
|
XP Professional |
|
|
|
|
|
|
|
|
|
|
|
Windows 2000 |
IIS 5.1 |
SQL Server 2000 |
Internet |
MDAC 2.7 |
Develop and |
Server, Advanced |
|
Standard or |
Explorer 5.5 |
|
Deploy |
Server, Data Center |
|
Enterprise |
|
|
|
|
|
|
|
|
|
For more information on Windows 2000, including demonstration versions and purchasing a license visit http://www.microsoft.com/windows2000/.
Note
Furthermore, in order to run many of the examples in this book you will need to have access to one of the following versions of SQL Server 2000:
SQL Server 2000 Developer Edition
SQL Server 2000 Standard Edition
SQL Server 2000 Enterprise Edition
SQL Server Developer Edition is the only version of those listed above that you will be able to install with Windows 2000 Professional. If you are running Windows 2000 Server, Advanced Server or Data Center, then you can choose the Standard or Enterprise versions of SQL Server. Please note that while we recommend that you utilize SQL Server 2000 as your choice for a database platform, you can also use SQL Server 7.0 for the vast majority of examples in the book.
The .NET Framework includes the option to install the SQL Server 2000 Desktop Edition (MSDE), however this version of SQL Server does not include its own user interface or tools, instead users interact with MSDE 2000 through the application in which it is embedded. MSDE 2000 is packaged with the .NET Framework, but will not be suitable for running all of the scenarios needed for this book.
Note
For more information on SQL Server 2000 editions, downloading demo versions of the product, or purchasing a license, please go to http://www. microsoft.com/sql/techinfo/planning/SQLResKChooseEd.asp
Table 2-2 provides a consolidated list of locations for you to download core components of the .NET Framework, including operating systems, databases, and data access components.