Synopses & Reviews
The popularity of Microsoft's Active Server Pages (ASP) technology is growing rapidly. Part of the reason is ASP's flexibility: the output of ASP scripts is most commonly HTML, which is included in the text stream returned to the client, making it a convenient way of creating browser-independent web content. But an additional reason--and one that will become more and more important over time, as webapplications replace web pages--is its extensibility. And the most effective way to extend ASP is to develop custom ASP components.However, the techniques for developing custom ASP components, along with the snags and pitfalls of developing custom components, are not well documented. In addition, to successfully develop ASP components one must be a jack-of-all-trades: programming requires some knowledge of COM, of threading models, and of the ASP object model, as well as a mastery of one or more language tools and development environments.That's where Developing ASP Components comes in. The first section of the book explores the topics all developers need to know to develop components for ASP effectively:
- The configuration of the ASP development environment
- ASP components and the Component Object Model (COM)
ASP components and threading models- ASP components and the Microsoft Transaction Server, which can be used to provide a variety of services to ASP components
- The objects, properties, methods, and events available in the ASP object model
Because more and more developers find themselves using more than a single language tool, the remaining three sections of the book each focus on ASP component development using any of the three major development tools: Microsoft Visual Basic, Microsoft Visual C++ and the ActiveX Template Library (ATL), and Microsoft J++. Each section carefully focuses on the issues that concern the ASP component developer who is using that particular development environment. These include:
- Accessing ASP's intrinsic objects
- Accessing data using either OLE DB (in the case of C++) or ADO (in the case of VB and J++)
- Creating n-tier web applications with VB
- Handling persistence using MFC along with Visual C++/ATL
- Accessing native code (the Windows libraries, which are written in C) from J++
This thorough coverage of the background information needed for developing ASP components, as well as its focus on the component development in each of three major development environments, makes
Developing ASP Components the definitive resource for the ASP application and component developer.
Synopsis
Designing Active Server Pages is for developers who have already mastered the basics of ASP application development and are ready to take the next logical step. It shows how to create powerful, reusable ASP pages. It also covers various Microsoft and third-party components that can enhance the power and versatility of ASP pages. This book is sure to become an indispensable part of every web developer's library.
Synopsis
Microsoft's Active Server Pages (ASP) is rapidly gaining in popularity because of its extensibility. And the most effective way to extend ASP is to develop custom ASP components. Bridging the documentation gap, this book covers techniques for developing ASP components, including the inevitable snags and pitfalls. It explores: The configuration of the ASP development environmentASP components and the Component Object Model (COM)ASP components and threading modelsASP components and the Microsoft Transaction ServerThe objects, properties, methods, and events in the ASP object model This book focuses on ASP component development using any of the three major development tools: Visual Basic, Visual C++ (and the ATL), and J++. It covers accessing ASP's intrinsic objects, accessing data using OLE DB or ADO, creating n-tier web applications with VB, handling persistence using MFC with Visual C++/ATL, and accessing native code from J++. "Developing ASP Components is the definitive resource for the ASP application and component developer.
About the Author
Shelley Powers has been working with, and writing about, web technologies--from the first release of JavaScript to the latest graphics and design tools--for more than 12 years. Her recent O'Reilly books have covered the semantic web, Ajax, JavaScript, and web graphics. She's an avid amateur photographer and web development aficionado, who enjoys applying her latest experiments on her many web sites.
Table of Contents
Developing ASP Components
Table of Contents
Foreword
Preface
I. Introduction
1. Writing ASP Components
A Little History
ASP: What It Is and How It Works
ASP and ASP Components
Integrating MTS with ASP Components
Accessing Data with ASP Components
Further Reading
2. Setting Up and Maintaining the ASP Development Environment
Creating an ASP Test Application Virtual Directory
The IIS Metabase
The IIS Admin Objects
The ADSI Container Object Properties and Methods
The IIS Base Admin Object
For Further Reading
3. ASP Components and COM
A Very Brief Overview of COM
How COM Is Implemented
Implementing COM in Visual C++, Visual Basic, and Visual J++
How COM Is Implemented with Visual C++
A COM Component Implemented with Visual Basic
A COM Component Created with Visual J++
Further Reading
4. ASP Components and Threads
What Are Threads?
Are Single-Threaded or Multithreaded Components Better?
The Single-Threaded and Multiple-Threaded Apartment Schemes
Further Reading
5. Components, Transactions, and the Microsoft Transaction Server
Developing Component-Based Systems
MTS, MTS Components, and Transactions
Creating MTS-Aware ASP Components
Creating an MTS Test Environment
Installing and Monitoring an MTS Component in an ASP Environment
MTS as a Component Management Tool
Further Reading
6. Overview of the Intrinsic (Built-in) Objects
The Application Object
The Session Object
The Server Object
The Request Object
The Response Object
Further Reading
II. Developing ASP Components with Visual Basic
7. Creating a Simple Visual Basic ASP Component
Creating an In-Process or Out-Of-Process Component
Component Instancing
Component Execution and Threads
Creating the Component Methods
Generating, Registering, Installing, and Testing the Component
Adding Error Handling
Further Testing and Debugging Techniques
Further Reading
8. The Visual Basic Built-in Object Interfaces
Accessing the Built-in Objects in IIS 3.0
The ObjectContext Interface
The Application Object Interface
The Session Object Interface
The Request Object Interface
The Response Object Interface
The Server Object Interface
Further Reading
9. Creating VB Data Access Components
Using ActiveX Data Objects (ADO)
Accessing Data from a VB ASP Component
Creating Interactive Database Query ASP Components
Building a Library of Data Access Components
Further Reading
10. Creating N-Tier ASP Components Using Visual Basic
What Is an N-Tier Application, and Why Is It Necessary?
Passing a Result Set to the ASP Page
Creating a Presentation Layer "Helper" ASP Component
Updating Multiple Tables Within One ASP Component
Simple Inserts Within an ASP Data Component Layer
Deleting Rows and Foreign Key Constraints
Database Updates with ASP Components and ADO
Further Reading
III. Developing ASP Components with Visual C++
11. Creating a Simple C++ ASP Component
ATL or MFC
Using ATL AppWizard to Generate the Basic ASP Component Project
Adding an ATL Object
Adding Methods to the Interface
Error Handling
Further Reading
12. The C++ ASP Built-in Interfaces
Accessing Built-In Objects in IIS 3.0
IIS 4.0, MTS, and ObjectContext
The Application Object Interface
The ISessionObject Interface
The IRequestObject Interface
The IResponse Interface
The IServer Interface
Further Reading
13. Integrating Data Access in C++ ASP Components with OLE DB
OLE DB, ADO, and the OLE DB Templates
OLE DB Basics
Using the ATL OLE DB Templates
Integrating OLE DB and ASP with MTS
Creating a Parameterized Stored Procedure Call
Updating Data
Further Reading
14. Persistence with ASP Components Using ATL and MFC
Combining MFC and ATL
File Access from ASP Components
Creating a Serializable Class
Persistence Through Object Serialization
Using Threads for Background Processes
Further Reading
IV. Developing ASP Components with Visual J++
15. Creating a Simple Java Component
What Are JavaBeans?
Component Execution and Threads
Creating the Java Class
Registering and Installing a Java Component Using javareg
Examining and Altering Component Properties with the OLE/COM Viewer
Testing the Java Component
Invoking a COM Object in a Java Component
Adding Error Handling
Further Reading
16. The Java Interfaces
IIS 3.0 and the IScriptingObject Interface
IIS 4.0 and the IObjectContext and IGetContextProperties Interfaces
The ASP Built-In Object and Helper Interfaces
The Java Component Framework
Further Reading
17. Integrating Java ASP Components with ADO and MTS
DAO, RDO, OLE DB, and ADO
Connecting to a Data Source with ADO
Querying the Data
Updating the Data
Multiple SQL Statements and Batch Updates
Transaction Management Across Multiple ASP Components
Further Reading
18. Java ASP Components and J/Direct, Native Code, and Marshaling
The Different Native Code Approaches
An Overview of J/Direct
Further Reading
Index