developing applications with visual studio.net

831 431 0
developing applications with visual studio.net

Đ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 [...]... Thursday, February 22, 2001 1:27 PM Preface Developing ASP components requires knowledge not just of one tool or of one technology, but of many You have to become familiar with one or more development tools, such as Visual Basic or Visual C++ (this book covers both, along with Visual J++, Delphi, and Perl), and of course you also have to become familiar with the tools’ underlying language However,... using Visual Basic and Visual C++ In the case of Visual Basic, chapters include accessing the intrinsic ASP objects from a Visual Basic component, accessing data using ADO, incorporating messaging with CDO for Windows 2000, using MSMQ, and using components to generate XML The Visual C++ chapters discuss some of this same material (accessing ASP intrinsics, data access using ADO, using MSMQ), along with. .. involved with clients and components that are based on different threading models Once you’ve become familiar with working with a tool that supports COM component development and you’re aware of some of the issues involved with COM development, you still have other new technologies to learn As you develop ASP components, you need to become familiar with web-based development in general and with the... interface with Active Server Pages and, most commonly, with Microsoft’s Internet Information Server (IIS) Consequently, you need to develop a certain level of familiarity with COM, the Component Object Model that underlies much of Microsoft’s technology Becoming familiar with COM development in turn requires that you become familiar with threads, so that you can understand how a COM component interacts with. .. This book is geared to the developer who has worked with one of the target languages/tools but either has not created COM objects before or has not worked with developing ASP components or ASP applications I hope that the book provides enough of an introduction to COM and threads to make you feel more comfortable with these topics if you haven’t worked with them before and to provide a good review if... service functionality to an ASP application Using ADSI is demonstrated using Visual Basic in Chapter 12, Working with Active Directory from ASP Applications; using ADSI with Visual C++ is discussed in Chapter 17, Accessing Active Directory from C++ Components Collaborative Data Objects (CDO) for Windows 2000 can be used from within your ASP components to send and retrieve email messages The messages... discussed in Chapter 12, Working with Active Directory from ASP Applications • Microsoft Message Queue (MSMQ) is examined in Chapter 13, Working with MSMQ Components The third portion of the book, consisting of six chapters, treats component development using Visual C++ In addition, its chapters serve as a kind of model for ASP component development using a high-level language like Visual C++ that exposes much... checks to make sure all of the components have made updates without errors ASP applications can participate in COM+ transactions, and transaction management can occur within an ASP page, an ASP component, or both A transaction can be created within an ASP page and then used for all of the components created directly from the page or created from within another component accessed in that page Failure in... accessed from its parent objects within the hierarchy With ADO, an object like a result set can be accessed and used directly without having to access it from either a command or a database connection, unless this hierarchical access is what you want In Chapter 8, Creating ASP/ADO Components, ADO is used to demonstrate basic data access techniques with ASP components created using Visual Basic, though the... Chapter 9, Creating an ASP Middle Tier with ADO, describes some of the techniques and issues to be aware of when developing a component for the middle tier In addition, Chapter 15, Adding Data Access to C++ Components with ADO, covers the use of ADO from Visual C++, and the other language chapters in the final section of the book each demonstrate how to use ADO with that specific language Windows 2000 . 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. 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. 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

Ngày đăng: 01/06/2014, 00:50

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