o'reilly - developing asp components 2nd edition

831 426 0
o'reilly - developing asp components 2nd edition

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

for all ROR Fly Downsky epubcn Developing ASP Components ,TITLE.22004 Page 1 Thursday, February 22, 2001 1:39 PM ,TITLE.22004 Page 2 Thursday, February 22, 2001 1:39 PM Developing ASP Components Second Edition Shelley Powers Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo ,TITLE.22004 Page 3 Thursday, February 22, 2001 1:39 PM Developing ASP Components, Second Edition by Shelley Powers Copyright © 2001, 1999 O’Reilly & Associates, Inc. All rights reserved. Printed in the United States of America. Published by O’Reilly & Associates, Inc., 101 Morris Street, Sebastopol, CA 95472. Editor: Ron Petrusha Production Editor: Leanne Clarke Soylemez Cover Designer: Hanna Dyer Printing History: April 1999: First Edition. March 2001: Second Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly & Associates, Inc. ActiveX, JScript, Microsoft, MSDN, Visual Basic, Visual C++, Win32, Windows, and Windows NT are registered trademarks and Active Directory is a trademark of Microsoft Corporation. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly & Associates, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. The association between the image of an asp and developing ASP components is a trademark of O’Reilly & Associates, Inc. While every precaution has been taken in the preparation of this book, the publisher assumes no responsibility for errors or omissions, or for damages resulting from the use of the information contained herein. ISBN: 1-56592-750-8 [M] ,COPYRIGHT.21880 Page 1 Thursday, February 22, 2001 1:39 PM About the Author Shelley Powers is a consultant/author with her own company, Burning Bird Enter- prises. In the last several years, she has worked with a variety of distributed, Internet, and Web development applications, for different platforms and using a variety of tools. Shelley has authored or coauthored books on Dynamic HTML, JavaScript, Java, CGI, Perl, P2P, general Web technologies, and more. Shelley can be reached at shelleyp@yasd.com, and her book support site can be found at http://www.burningbirdenterprises.com. Colophon Our look is the result of reader comments, our own experimentation, and feed- back from distribution channels. Distinctive covers complement our distinctive approach to technical topics, breathing personality and life into potentially dry subjects. The animal on the cover of Developing ASP Components, Second Edition, is an asp, which is a term applied to various venomous snakes, including the depicted asp viper (Vipera aspis) of Europe as well as the Egyptian cobra (Naja haje), thought to have been the means of Cleopatra’s suicide. Needing to eat at least 50-60% of their body weight in food per week, European asp vipers hunt by lying in wait for approaching prey. After grabbing and biting a small rodent or other prey, they release it and wait several minutes for it to stop moving; the generally sluggish viper rarely chases prey. Vipers know their home territory very well, which allows quick escape from their asp-kicking natural enemies, serpent eagles, and hedgehogs. This trick hasn’t helped them escape from their greatest threat, the expansion of human civilization, which frequently wipes out large sections of their territory. The chemical composition of asp viper venom can vary from one population to the next, hampering initial antivenin development until 1896, but few viper bite fatalities occur in Europe today. Leanne Soylemez was the production editor and proofreader for Developing ASP Components, Second Edition. Norma Emory was the copyeditor, Mary Anne Weeks Mayo and Colleen Gorman provided quality control, and John Bickelhaupt wrote the index. Hanna Dyer designed the cover of this book, based on a series design by Edie Freedman. The cover image is a 19th-century engraving from the Dover Pictorial ,AUTHOR.COLO.21750 Page 1 Thursday, February 22, 2001 1:39 PM Archive. Emma Colby produced the cover layout with QuarkXPress 4.1 using Adobe’s ITC Garamond font. David Futato designed the interior layout based on a series design by Nancy Priest. Judy Hoer converted the files from MSWord to FrameMaker 5.5 using tools created by Mike Sierra. The text and heading fonts are ITC Garamond Light and Gara- mond Book; the code font is Constant Willison. The illustrations that appear in the book were produced by Robert Romano using Macromedia FreeHand 8 and Adobe Photoshop 5. This colophon was written by Nancy Wolfe Kotary. Whenever possible, our books use a durable and flexible lay-flat binding. If the page count exceeds this binding’s limit, perfect binding is used. ,AUTHOR.COLO.21750 Page 2 Thursday, February 22, 2001 1:39 PM v Oracle 8i Internal Services for Waits, Latches, Locks, and Memory, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc. All rights reserved. Table of Contents Preface xi 1. Writing ASP Components 1 The Role ASP Components Play 2 Why Use ASP Components? 3 COM+ Services and ASP Components 5 Accessing Data with ASP Components 8 Windows 2000 Technologies Accessible from ASP Components 10 A Rose by Any Other Name: Programming Language Choice 11 What About ASP.NET? 13 2. Setting Up the ASP Development Environment 14 Configuring the IIS Environment 15 Remote Administration of IIS 27 Using ADSI to Administer IIS Programmatically 29 IIS Admin Object Overview 46 The IIS Base Admin Objects 59 3. ASP Components and COM 69 Overview of COM for ASP Component Developers 70 How COM Is Implemented 76 Notable COM Interfaces 80 COM Datatypes 87 4. ASP Components, Threads, and Contexts 91 What Are Threads? 92 Threads and Apartments 95 ,aspcTOC.fm.21592 Page v Thursday, February 22, 2001 1:38 PM vi Table of Contents Oracle 8i Internal Services for Waits, Latches, Locks, and Memory, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc. All rights reserved. The Threading Models 96 What Are COM+ Contexts? 110 5. COM+ Services and ASP Components and Applications 114 Developing Component-Based Systems 114 The COM+ Interfaces 116 Porting MTS Packages to COM+ Applications 124 Activating COM+ Applications 125 COM+ Services 127 6. ASP Interaction: Scripting and ASP Components 136 Scripting Language Support Within ASP 136 Instantiating Components 139 COM+ Datatypes and Script/Component Interaction 145 Passing Arrays as Parameters 159 Error Handling Between Component and Script 174 7. Creating a Simple Visual Basic ASP Component 180 Creating an In-Process or Out-Of-Process Component 181 Component Instancing 182 Component Execution and Threads 184 Creating an ASP Project 187 Creating Component Methods 188 Generating, Registering, Installing, and Testing the Component 190 Adding Support for COM+ Services 191 Converting MTS Components for Use with COM+ 201 Accessing the ASP Built-in Objects 202 Error Handling 220 Debugging 222 Performance Issues 222 8. Creating ASP/ADO Components 225 Accessing ADO from a VB Component 226 Creating a Simple ADO Component 227 The ADO Model 233 File and Directory Access with ADO Streams and the Record Object 256 Persisting Data 262 9. Creating an ASP Middle Tier with ADO 266 How Separate Should the Layers Be? 267 Creating ADO Data Wrappers 268 ,aspcTOC.fm.21592 Page vi Thursday, February 22, 2001 1:38 PM Table of Contents vii Oracle 8i Internal Services for Waits, Latches, Locks, and Memory, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc. All rights reserved. Defining Business Objects 281 Other Data Integrity Issues 295 10. Server-Side XML Through VB ASP Components 298 XML Basics 298 Formatting XML 302 Working with XML in ASP Applications 307 XML and ADO: Saving Recordsets as XML 315 11. Take a Message: Accessing CDO from ASP Components 321 A Brief Overview of CDO 322 The CDO Object Model 322 Send This URL to a Friend 324 Working with the Message Body 328 Retrieving and Reading Messages 338 12. Working with Active Directory from ASP Applications 344 A Brief Overview of Active Directory in Windows 2000 345 Setting Up an Isolated Active Directory Environment 345 A Refresher on ADSI 347 Binding to Active Directory Objects 349 Using the Active Directory Services Viewer 355 Manipulating Containers 357 Searching Active Directory with ADO 362 ASP Example: Add and Manage Users Through the Web 366 13. Working with MSMQ Components 380 MSMQ/ASP Basics 380 Working with Queues 382 Working with MSMQ Messages 389 Using Transactions 394 Journaling 407 A Brief Word on Message Security 412 14. Creating C++ ASP Components 414 ATL or MFC 415 Using ATL AppWizard to Generate the Basic ASP Component Project 416 Adding an ATL Object 421 Code Changes Based on Adding a New Object 426 Adding Methods to the Interface 427 Adding Support for COM+ Services 432 ,aspcTOC.fm.21592 Page vii Thursday, February 22, 2001 1:38 PM [...]... systems and access CORBA-based components with the support of products such as Iona’s COM-CORBA Bridge and others The Role ASP Components Play As stated earlier, ASP components are COM+-based components that encapsulate a specific functionality and that are invoked either directly from an ASP page or indirectly via some other ASP component If you have worked with COM+ before, ASP components don’t use... client for ASP being the web server I say usually with some reservation, since there is no requirement that ASP components must reside on the same machine as the client application In addition, an ASP component is almost always an in-process (ActiveX DLL) component, though you can use out-of-process components if you wish However, ASP is optimized for in-process access of components As in-process COM+... 611 The ASP Built-in Object and Helper Interfaces 619 Accessing ADO from Java Components 633 21 Creating ASP Components with Delphi 642 Using the COM Wizards to Create ASP Components Manually Adding Support for COM+ /ASP Working with the ASP Objects Working with ADO Working with Windows 2000 Functionality: CDO 642 653 660 668 672 22 Perl-Based Components. .. 1: Writing ASP Components The information available to an ASP component is also available to ASP scripting blocks, so why use components when you can use scripting, especially since scripting is fairly simple to use and can be learned relatively quickly? The first and foremost reason to use ASP components instead of in-page ASP scripting blocks is reusability It’s difficult to package an ASP script... Admin Objects Chapter 3, ASP Components and COM, examines Microsoft's Component Object Model (COM), which provides the basis for developing all types of components Chapter 4, ASP Components, Threads, and Contexts, provides developers with the information that they need to know about threading models when developing ASP components, and particularly when accessing global data from the ASP Application object... covered in Chapter 20, ASP Components Created with Java • Delphi is discussed in Chapter 21, Creating ASP Components with Delphi • Perl is covered in Chapter 22, Perl-Based Components Using ActiveState’s PDK • Windows Script Components (WSC), a scriptable yet powerful development environment for creating ASP components, is discussed in Chapter 23, Creating Scripting Language Components Finally, the... can be maintained within ASP components in a layer between the web pages and the business logic and used for all database queries COM+ Services and ASP Components ASP Components within the Windows 2000 environment can use one of several COM+-managed services to enhance the performance of both the component and the component’s ASP application One popular COM+ service is just-in-time (JIT) activation JIT... an ASP application However, if a component does not access the ASP- specific objects provided through the ASP object model, it can be used within a distributed application, from other components (whether or not they’re part of an ASP application), or even within a flat one-tier application that has no involvement with ASP, IIS, or the Internet From this point This is the Title of the Book, eMatter Edition. .. implementing ASP components; it handles almost all of the details associated with the implementation of a COM component Using ATL and accessing the ASP built-in objects are covered in Chapter 14, Creating C++ ASP Components In addition, Chapter 19, Persistence with ASP Components Using ATL and MFC, provides coverage of file I/O in addition to serializing information for persistence beyond the life span of an ASP. .. shouldn’t be created using the free-threaded model either, since all communication between the ASP page and the component must then be marshaled, a process that can impact on the ASP application’s performance There is an additional constraint if you’re using a multithreaded model such as the both-threaded model: the ASP components must be thread-safe What’s a threadsafe ASP component? One that does not . epubcn Developing ASP Components ,TITLE.22004 Page 1 Thursday, February 22, 2001 1:39 PM ,TITLE.22004 Page 2 Thursday, February 22, 2001 1:39 PM Developing ASP Components Second Edition Shelley. animal on the cover of Developing ASP Components, Second Edition, is an asp, which is a term applied to various venomous snakes, including the depicted asp viper (Vipera aspis) of Europe as well. eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc. All rights reserved. Table of Contents Preface xi 1. Writing ASP Components 1 The Role ASP Components Play 2 Why Use ASP Components?

Ngày đăng: 25/03/2014, 10:41

Từ khóa liên quan

Mục lục

  • Cover

  • Copyright

  • About the Author

  • Table of Contents

  • Preface

  • Ab The Weaver Database

  • Index

Tài liệu cùng người dùng

Tài liệu liên quan