for all ROR Fly Downsky epubcn ,TITLE.22004 Page Thursday, February 22, 2001 1:39 PM Developing ASP Components ,TITLE.22004 Page Thursday, February 22, 2001 1:39 PM ,TITLE.22004 Page Thursday, February 22, 2001 1:39 PM Developing ASP Components Second Edition Shelley Powers Beijing • Cambridge • Farnham • Kưln • Paris • Sebastopol • Taipei • Tokyo ,COPYRIGHT.21880 Page 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] ,AUTHOR.COLO.21750 Page Thursday, February 22, 2001 1:39 PM About the Author Shelley Powers is a consultant/author with her own company, Burning Bird Enterprises 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 feedback 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 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 Garamond Book; the code font is Constant Willison The illustrations that appear in the book were produced by Robert Romano using Macromedia FreeHand and Adobe Photoshop 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 ,aspcTOC.fm.21592 Page v Thursday, February 22, 2001 1:38 PM Table of Contents Preface xi Writing ASP Components The Role ASP Components Play Why Use ASP Components? COM+ Services and ASP Components Accessing Data with ASP Components Windows 2000 Technologies Accessible from ASP Components 10 A Rose by Any Other Name: Programming Language Choice 11 What About ASP.NET? 13 Setting Up the ASP Development Environment 14 Configuring the IIS Environment Remote Administration of IIS Using ADSI to Administer IIS Programmatically IIS Admin Object Overview The IIS Base Admin Objects 15 27 29 46 59 ASP Components and COM 69 Overview of COM for ASP Component Developers How COM Is Implemented Notable COM Interfaces COM Datatypes 70 76 80 87 ASP Components, Threads, and Contexts 91 What Are Threads? 92 Threads and Apartments 95 v Oracle 8i Internal Services for Waits, Latches, Locks, and Memory, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcTOC.fm.21592 Page vi Thursday, February 22, 2001 1:38 PM vi Table of Contents The Threading Models 96 What Are COM+ Contexts? 110 COM+ Services and ASP Components and Applications 114 Developing Component-Based Systems The COM+ Interfaces Porting MTS Packages to COM+ Applications Activating COM+ Applications COM+ Services 114 116 124 125 127 ASP Interaction: Scripting and ASP Components 136 Scripting Language Support Within ASP Instantiating Components COM+ Datatypes and Script/Component Interaction Passing Arrays as Parameters Error Handling Between Component and Script 136 139 145 159 174 Creating a Simple Visual Basic ASP Component 180 Creating an In-Process or Out-Of-Process Component Component Instancing Component Execution and Threads Creating an ASP Project Creating Component Methods Generating, Registering, Installing, and Testing the Component Adding Support for COM+ Services Converting MTS Components for Use with COM+ Accessing the ASP Built-in Objects Error Handling Debugging Performance Issues 181 182 184 187 188 190 191 201 202 220 222 222 Creating ASP/ADO Components 225 Accessing ADO from a VB Component Creating a Simple ADO Component The ADO Model File and Directory Access with ADO Streams and the Record Object Persisting Data 226 227 233 256 262 Creating an ASP Middle Tier with ADO 266 How Separate Should the Layers Be? 267 Creating ADO Data Wrappers 268 Oracle 8i Internal Services for Waits, Latches, Locks, and Memory, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcTOC.fm.21592 Page vii Thursday, February 22, 2001 1:38 PM Table of Contents vii Defining Business Objects 281 Other Data Integrity Issues 295 10 Server-Side XML Through VB ASP Components 298 XML Basics Formatting XML Working with XML in ASP Applications XML and ADO: Saving Recordsets as XML 298 302 307 315 11 Take a Message: Accessing CDO from ASP Components 321 A Brief Overview of CDO The CDO Object Model Send This URL to a Friend Working with the Message Body Retrieving and Reading Messages 322 322 324 328 338 12 Working with Active Directory from ASP Applications 344 A Brief Overview of Active Directory in Windows 2000 Setting Up an Isolated Active Directory Environment A Refresher on ADSI Binding to Active Directory Objects Using the Active Directory Services Viewer Manipulating Containers Searching Active Directory with ADO ASP Example: Add and Manage Users Through the Web 345 345 347 349 355 357 362 366 13 Working with MSMQ Components 380 MSMQ/ASP Basics Working with Queues Working with MSMQ Messages Using Transactions Journaling A Brief Word on Message Security 380 382 389 394 407 412 14 Creating C++ ASP Components 414 ATL or MFC Using ATL AppWizard to Generate the Basic ASP Component Project Adding an ATL Object Code Changes Based on Adding a New Object Adding Methods to the Interface Adding Support for COM+ Services Oracle 8i Internal Services for Waits, Latches, Locks, and Memory, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved 415 416 421 426 427 432 ,aspcIX.fm.21459 Page 796 Thursday, February 22, 2001 1:38 PM 796 Index unique identifiers, 70 Unix environments, support within, 71 COM datatypes, other than Variant, 154 COM object model MSMQ object models, 381–413 COM+ Services header file, 432 including support in C++ components, 472 library, adding to objects, 433 MTS files, wrapping within, 441 COM+ services for ASP components, 114 COM VARIANT data type, 87 COM⁄COM+ contexts, 110 COM/COM+ accessing built-in constants and enumerators, 142 COM/COM+ objects, comdef.h, 447 Command object, 250–256, 490–497 Parameter objects, collection, 490 parameters collection, 253 stored procedures, 253 CommandType property, 250 CommandTypeEnum, 236, 237 CommitTrans method, 237 Component Object Model (see COM) component-based systems, 114 components, deactivation, 200 component/script interaction, 136 compute-bound threads, 93 comsvcs.h, 432 configured components, 127 Connection object, 234–242, 470–478 accessing schema information from OLE DB provider, 476 ADO type library, enumerated properties, 236 data source specification via Open method, 236 Errors collection, 240 iteration through Properties collection, 239 properties and methods, 471 Properties collection, 238 transaction methods, 237 connection string, data access via ADO, 229 connection.h header file, 472 ConnectionString property, 235 consistency, transaction managements, 296 container.h header file, 532 containers, 352 containment/delegation, 83 Contents collection, enumeration through, 207 ContentType property, 216 ContextInfo property, 117 contexts, 92, 110, 116 and apartments, 111 cookie dictionary, 213 cookies, 217 Cookies collection, 209 copyFile method, 260, 502 write permissions, 504 Count property, 118 CPP file, 420 createGroup method, 540 CreateInstance method, 117, 432, 475 exception processing support, adding, 499 CreateMHTMLBody method, 514 createMHTMLBody method, 325 CreateObject method, 201 instantiation of components, 140 createRecordset method, 245, 480 createUser method, 366 createXatQueue method, 395, 574 cross-thread communication, 94 CSS (Cascading Style Sheets), 299, 302–304 files, creating, 303 CStdioFile class, 585 parameters, 586 CTypeTable.h header file, 487 CURRENCY datatype, 429 CursorLocation properties, 479 Cursors, 243 cursors client side, 244 saving ADO recordsets as XML, 316 CursorType properties, 479 CursorType property, 243 D DAO (Data Access Objects), 225 This is the Title of the Book, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcIX.fm.21459 Page 797 Thursday, February 22, 2001 1:38 PM Index 797 data, archiving, 296 data integrity component code, enforcing within, 295 formatting of data, 295 range checking, 295 data layer, 266 data, persisting, 262–265 data, persisting (see persisting data) data source connections, implementing in ADO, 228 data types COM, 87 for parameters passed to methods, 189 memory allocation, 89 data wrappers, 268–281 as maintenance subroutines, 272 business objects, compared to, 281 creating, 270 queries, 277 database connection string, 472 datatypes, 145–174 COM other than Variant, 154 COM, other than Variant, 154 compatibility of ASP script and component types, 158 multiple scripting languages and the LCD, 153 SAFEARRAY, 159 scripting in multiple languages, 153 testing, importance of, 154 Variant, 145–154 dcomcnfg.exe, 72 Deactivate method, 123, 447 dead-letter queue, 411 dead-letter queue, reading, 412 deadlocks, 93 debugging, 55 debugging ASP components, 222 DECLARE_SERIAL macro, 590 decoration, 77 DEF, 420 Delete method, 361 MSMQQueueInfo object, 558 deleteHtmlPage method, 293 deleteMediaType method, 272 deletePage method, 285 dependent objects, 183 development environment address and port specification, 17 difference between a collection and a group, 353 directory services, necessity of, 383 DisableCommit method, 117, 432 DISPID, 81 display attribute, 303 displayFileNames method, 257, 500 distinguishedName, 370 distinguishedName (DN) property,, 351 distributed systems, 114 Distributed Transaction Controller (DTC), 399 DLL code for ASP components, 419 DLL (dynamic link library), 181 dllhost.exe, 126, 181 Document Type Definition (see DTD) DOM (Document Object Model), 308 doQuery method, 364, 545 dot (.), 385 double datatype, 429 DropDirectory object, 339 DSN (Data Source Name) referencing in Connection object, 235 DTC (Distributed Transaction Controller), 399 DTD (Document Type Definition), 300 and valid XML documents, 301 dual interface, 82 dual type, 177 durability, transaction management, 296 dwMDAttributes, 62 dwMDDataLen, 62 dwMDDataType, 62 dwMDIdentifier, 62 dwMDUserType, 62 dynamic link libraries (see DLL) E early binding, 81, 223 of ADO in ASP components, 226 EJB (Enterprise JavaBeans), 269 email readers creating, 522 exception handling, 525 message list, displaying, 523 messages, displaying and deleting, 526 eml file extension, 521 EnableCommit method, 117, 432 encoding methods, Server object, 218 This is the Title of the Book, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcIX.fm.21459 Page 798 Thursday, February 22, 2001 1:38 PM 798 Index end dating, 296 End method, 449 END_ADO_BINDING macro, 486 enumeration, 536 enumerator interfaces, 84 enumObjects method, 353, 534 enumObjectsByFilter method, 357 EOF (end-of-file) ADO and C++ definitions, 508 Err object, 220 error handling ASP components, Visual Basic, 220 between component and script, 174–178 C++ components, 463–467 C++ components, enabling, 464 JScript, 174 PerlScript and Win32::OLE, 177 testing in PerlScript, 178 testing JScript ;VBScript, 175 VBScript, 174 escaping of backslashes in pathnames, C++, 553 exception handling (see error handling) Execute method, 236 ExecuteOptionEnum, 236 ExecuteSearch method, 546 ExitInstance method, 582 Expires property, 216 ExpiresAbsolute property, 217 Extensible Markup Language (see XML) Extensible Stylesheet Language Transformations (see XSLT) Extensible Stylesheet Language (XSL), 305 Extensible Stylesheet language (XSL), 299 external transactions, 394, 399–407 F FAILED macro, 463 file I/O, permissions, 319 file-based I⁄O using MFC, 584–588 Filter property, 248, 479 Filter property, IADsContainer, 357 findQueue method, 387 findQueues method, 560, 564 fixed thread pooling, 184 thread assignment, 185 float datatype, 429 Flush method, 449 for-each element, XSLT, 305, 306 Form collection, 209, 457 FormatName property, queues, 388 free-threaded components with global data, problems, 104 free-threaded marshalers, 95 free-threaded model, 104, 424 G game.h header file, 590 GET method, 210 Get method, 35, 348 GetActivityId method, 119 get_Buffer method, 449 get_ClientCertificate method, 457 getCodes method, 277 get_Contents method, 451 getContentValue method, 452 GetContextId method, 119 get_Cookies method, 457 GetCurrentTime method, 593 GetDeactivateOnReturn method, 120 GetDecodedContentStream and GetEncodedContentStream methods, 515 GetDecodedContentStream method, 332 getDescription method, 279 getDirectoryFrmQueue method, 401, 406 GetEx method, 36 get_Form method, 457 getGroups method, 376 GetIDsOfNames method, 81 GetInfo method, 349 getInfo method, 586 getIntrnlXactMsg method, 395, 397 get_LCIDmethod, 456 getMessage method, 341 GetMessages method, 322, 339 IDropDirectory interface, 521 getMessages method, 340 IMessages interface, 524 GetMyTransactionVote method, 120 GetObject method, 349, 357 getPageAssociations method, 290 GetRuntimeClass method, 588 getScore method, 593 get_ScriptTimeOut method, 463 get_StaticObjects method, 451 get_Status method, 450 getTimeout method, ??–66 This is the Title of the Book, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcIX.fm.21459 Page 799 Thursday, February 22, 2001 1:38 PM Index 799 get_Timeoutmethod, 456 GetTransaction method, 119 GetTransactionId method, 119 getUser method, 372 getUsers method, 371 get_Value method, 452 global access, 183 global settings, 55 global variable references and memory leaks, 186 global.asa connection string parameters, Access and SQL Server, 476 global.asa file, 141–144 and threading, 144 creating, 143 database connection string, 472 including type libraries, 142 global.asa files, 202 globally unique identifier (see GUID) GlobalMultiUse, 182 GlobalSingleUse, 182 group elements, properties, 359 groups, creating, 540 groups, removing, 542 GroupType property, 541 GUID, 352 GUID (Globally Unique Identifier), 33 GUID (globally unique identifier), 72 GUID header file, CDO, 507 GUIDGEN.EXE, 72 H HasKeys method, 213 header files warning, CObject class, 589 helper components, 268 helper function, 529 HRESULT datatype, 430 HRESULT return datatype, 428 HRESULT return type, 173 HTM type code, 253 HTML (Hyper Text Markup Language) limitations, 299 HTML (Hypertext Markup Language) use in XSLT, 306 HTML messaging, 512 HTMLBody property, 512 HTMLEncode method, 218, 461 I IADORecordBinding interface, 486–490 IADs 330, 350 IADs Collection, 353 IADs interface, 350 IADs interface properties, 348 IADs methods, 348 IADsCollection interface, 530 IADsContainer, 354 IADSContainer interface, 43 IADsContainer interface, 350, 352, 357, 530 IADsMembers, 353 IADsMembers interface, 531 IADsNamespaces interface, 350 IADsOpenDSObject interface, 350 IApplicationObject interface, 451–453 IBodyPart interface, 323, 331–338, 514 Attachments collection, 336 IClassFactory, 82 IConfiguration, 324 IConfiguration interface in CDO, 509 IContextState, 119 methods, 120 referencing, 437 transaction control, 197 transaction management, methods, 296 transactions, 129 icrsint.h file, 487 identifier, 142 IDirectorySearch interface, 544 IDispatch, 81 IDispatch datatype, 430 IDL file (Interface Definition Language file), 420 IDL (Interface Definition Language), 77 IDropDirectory interface, 521 IEnumXXXX interfaces, 84 IFirst interface, 426 IIS 5.0 error handling, method failures, 463 IIS Admin objects, 30–??, 46–58 methods, 34–43 properties, 52 IIS Base Admin objects methods, 59 IIS (Internet Information Server) development environment, set up, 16 installing, 15–18 upgrade, 16 This is the Title of the Book, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcIX.fm.21459 Page 800 Thursday, February 22, 2001 1:38 PM 800 Index remote administration, 27–68 ADSI, using, 29–46 using Internet Services Manager, 27 socket pooling, V 5.0, 18 virtual directories, 24 IIS Metabase, 29 METADATA_RECORD, 61 IMessage interface, CDO sending HTML messages, 512 IMessage interface in CDO, 509 IMessages collection iterating, 339 IMessages interface object, 322 Implements keyword, 79 Implements statement, 198 IMPLEMENT_SERIAL macro, 590 #import directive, 467, 508 import directive, 468, 469, 552, 570 IMSAdminBase interface and methods, 59 IMSMQMessagePtr, 568 IMSQQueueInfoPtr, 554 InitInstance method, 582 in-process components, 71, 181, 184 advantages, 417 ATL AppWizard, creating with, 417 IsCallerInRole, 195 usable classes, 182 in-process components, creating, 187 instancing property, 182 instantiating ASP components, 139–144 CreateObject method, 140 instantiation of components, 218 int datatype, 429 int64 datatype, 429 interception, 112 Interface Definition Language (IDL), 77 interfaces, 72, 76–86 creating, 78 enumerators, 84 methods, essential for COM, 75 ObjectContext, 192–197 referencing, 74 InterfaceSupportsErrorInfo method, 465 internal transactions, 394, 395–399 internationalization, 208 Internet Information Server (see IIS) Internet Services Manager setting default scripting language, 137 Invoke method, 81 IObjectContext, 116 methods, 117 properties, 117 transactions, 129 IObjectContext interface accessing ASP built-In objects, C++, 445 COM+ services, access through, 432 transaction support, 432 IObjectContextInfo, 119, 201 methods, 119 IObjectControl, 122, 198–200 CanBePooled method, 130 deactivating, 200 JIT functions, implementing, 120 methods, 123, 198 IObjectControl interface ASP components, reference in class definition, 438 just-in-time activation (JIT), 437–440 IP settings, development environment, 17 IRequest interface, 456–460 IRequestDictionary interface, 456 IResponse interface, 447–451 Buffer property, 449 caching control, 449 Cookies collection, 451 IsCallerInRole in-process components, 195 IsCallerInRole method, 117, 432 component access from client process, return of True value, 435 IsClientConnected method, 218 IScriptingContext interface and Windows 2000, 444 IServer interface, 460–463 ISessionObject interface, 454–456 IsInTransaction method, 117, 119, 432 IsKindOf method, 588 isolated development environment security, 25 isolated development environments, 19–24 ASP components, for testing, 20 testing, 20 isolation, transaction management, 296 IsSecurityEnabled method, 117, 432 IsSerializable method, 588 IsStoring method, 590, 593 IsTransactional parameter, 394 IStringList interface, 459 This is the Title of the Book, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcIX.fm.21459 Page 801 Thursday, February 22, 2001 1:38 PM Index 801 ISupportErrorInfo interface, 464 Item property, 118 IUnknown, 80 IUnknown datatype, 430 IUSR_MACHINENAME, 259 IVariantDictionary, enumeration with, 454 IWriteCookie interface, 451 J JIT (Just-in-Time) activation use in MSMQ message queue, 571 JIT (just-in-time activation), 122, 437, ??–440 COM+ dependency, C++ components, 437 in IObjectControl interface, 198–200 including support in C++ components, 473, 474 JIT methods, 532 Journal property, MSMQQeueInfo, 407 journaling, 407–412 JScript and Variant datatype, 146–148 arrays, 161, 165–168 ASP pages, support, 137 error handling, 174 just-in-time activation (JIT) for binding to Active Directory objects, 532 JustInTime.cpp file, inclusion of IObjectControl methods, 438 JustInTime.h file, 447 JustInTime.h file, addition, IObjectControl method prototypes, 438 L label, 554 language default, 58 LastError method, 177 late binding, 81 LCD (Lowest Common Denominator) Lowest Common Denominator (LCD), 153 LCID, 209 LDAP (Lightweight Directory Access Protocol), 345 library applications, 126 lightweight proxies, 112 listContents method, 455 load balancing, 115 fised thread pooling, negation under, 185 LoadFromFile method, 332, 516 local loopback address, 17 local settings, 55 localhost, 17 in Windows 2000, 18 LocalHost address, 29, 33 location transparency of COM components, 71 LockType properties, 479 LockType property, 244 long datatype, 429 LookUp method, MSMQQuery, 560 processing results in a loop, 561 lookup tables, size, 277 LookupQueue method, 386 M MachineIdOfMachineName method, 409 Make Project dialog, 190 MapPath method, 218, 311, 461 marshaling, 94, 181, 418 cross-process, 95 cross-thread, 95 performance issues, 184 memory allocation, databypes, 89 memory leaks and global variable references, 186 Message object Body property, 570 Message objects, 322 methods, 323 message queues, 382 message queues, creating pathnames for, 553 message.cpp file, including import directives, 510 messages MSMQ, 550 messaging, 321–343 CDO in C++ ASP components, 506–527 adding attachments, 518 plain text, sending, 509–512 retrieval and reading, 521–527 sending HTML and plain text, 512 sending multipart, 514 This is the Title of the Book, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcIX.fm.21459 Page 802 Thursday, February 22, 2001 1:38 PM 802 Index message body, 328–338 MSMQ, 568–580 MTS⁄COM+ transaction support, 576 reading and cleanup, drop folder, 340 "Send this URL to a friend", 324–328 URL for the current page, 326 SMTP access, 325 SMTP parameters, sendMultiPart method, 329 Metabase (see IIS Metabase) metadata, 240 METADATA_MASTER_ROOT_HANDLE, 63 METADATA_RECORD structure, 61 methods adding to an ATL-generated ASP component, 427 arguments, passing to, 189 ASP components, adding to with C++, 430 COM-based components, essential to, 75 creating for Visual Basic components, 188 IMSAdminBase objects, 59 interface, invocation on, 80, 81 marshaling, 94 under IObjectContext, 117 MFC (Microsoft Foundation Classes), 415 ATL components, advantages to using in, 581 ATL, using with in C++ ASP components, 581–595 initialization and termination functions, 582 Microsoft COM documentation, 90 data access technologies, supported, 225 Interface Definition Language (IDL), 77 Script Debugger, 55 Microsoft Extensible Markup Language (see MSXML) Microsoft Foundation Classes (see MFC) Microsoft Loopback Adapter, 346 Microsoft Message Queue (see MSMQ) Microsoft Message Queues (see MSMQ) Microsoft Platform SDK, 355 Microsoft Transaction Server (see MTS) Microsoft XML type library, included objects, 308 monikers, 75 m_piResponse private data member, 569, 583 MQCOLUMNSET, 565 MQ_DENY_NONE, 392 MQ_DENY_RECEIVE_SHARE, 392 MQGetQueueProperties, 566 MQGetQueueProperties function, 566 MQLocateBegin, 565 MQLocateEnd, 566 MQLocateNext, 565, 566 MQPathNametoFormatName function, 566 MQ_PEEK_ACCESS, 392 MQPROPERTYRESTRICTION, 565 MQPROPERTYRESTRICTION structure, 565 MQPROPVARIANT structures, 565 MQRESTRICTION.paPropRes member, 565 MSDAIPP.DSO, 257 msg method, 324 msgqueue class, 383 MSMQ messages, 389–413 adding transaction support, 575 authentication, 412 journaling, 407–412 message encryption, 413 receive timeout property, critical setting, 572 security, 412 senders and receivers, parameter differences, 393 transactions, 394–407 MSMQ (Microsoft Message Queue) and C++ ASP components, 550–580 components, 550 functions in C++, 551 header file, 552 libraries, adding to components, 552 MSMQ (Microsoft Message Queues), 380 ASP, using with, 380 COM object, 381–413 COM objects, using to search for queue, 560–564 MSMQ functions, searching for queues with, 564–568 MTS⁄COM+ transaction support, 576 removing, 557–560 transactions, 574 type library, 383 versions, compatibility, 413 MSMQ QueueInfo object, 554 This is the Title of the Book, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcIX.fm.21459 Page 803 Thursday, February 22, 2001 1:38 PM Index 803 MSMQ queues referencing, 557 MSMQCoordinatedTransaction object, 399 MSMQMessage object, 389, 568 MSMQQuery, 386 MSMQQuery method queue lookup, 557 MSMQQuery object searching for a queue with, 560 MSMQQueueInfo, 382–386 PathName property, 383 Update method, 407 MSMQQueueInfo object limitations, searching queues, 564 transactional messaging, setting, 394 using Create method to reference a queue, 558 MSMQQueueInfos, 386 MSMQTransaction object, 394, 575 MSMQTransactionDispenser object, 394, 575 m_spObjectContext, 569 MSXML (Microsoft Extensible Markup Language), 307 external XML documents, loading to XMLDOM object, 309 MTA (multithreaded apartment), 102 MTS components COM+, enabling compatibility with, 443 MTS (Microsoft Transaction Server), 127 components, porting to COM+, 201 object pooling, incompatibility, 442 packages, porting to COM+ applications, 124 MtsObject.cpp file, 442 MtsObject.h file, 442 multiformat messaging, 512 multipart messages, 328 multiple threading and marshaling, 425 multithreaded apartment (MTA) multithreaded apartments (MTA), 102 MultiUse, 182 N Name Admin object, 31 Name property, 31 namespaces, 302 ADO and CDO, 508 and CDO in C++ ASP components, 507 Namespaces container, binding to, 350 naming conflicts, prevention when using CDO, 507 neutral-apartment threading model, 110 neutral-threaded model (Windows 2000), 424 newMediaType method, 270 newPrivateQueue method, 384, 556 newPublicQueue method, 383, 386, 410, 554 no_namespace option, 508 n-tier application model, 266 n-tier applications separation of layers, 267, 268 O object pooling, 130–135 C++, 439 IObjectControl methods, implementation, 132 poolable components adding to a COM+ application, 134 creating, 131 header files, 131 testing, 135 threading, 130 object serialization, 588 distributed environments, 595 tag, 142 and threading, 144 tags, 202 ObjectContext, 116, 192–197, 201 access, via different programming languages, 116 early binding, 193 methods and properties, 192 MSMQ transaction management, 399 role-based security, 195 threading, 192 transaction control, 197 transaction management, methods, 296 transactions, 129 ObjectControl, 198 OLE DB, 225, 469 OLE DB Provider for Internet Publishing, 257 permissions, 258 OLE DB Provider for the Internet This is the Title of the Book, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcIX.fm.21459 Page 804 Thursday, February 22, 2001 1:38 PM 804 Index support through Microsoft Frontpage, 259 oleview.exe, 72 Open method, 235 data source specification, Connection object, 236 MSMQQueueInfo, parameters, 392 parameters, 500 OpenDSObject method, 350 OpenKey method, 63 OpenSchema method, 240, 476–478 parameters, 240 Option Explicit statement, 188 out-of-process components, 71, 181 advantages, 418 fixed thread pooling, 184 P page type codes, 253 page.cpp file, 488 PageSize property, 246, 479 paging, 245 pak (MTS package file), 124 Parameters collection, 253 parameters, passing by reference or value, 189 Parent property, 34 parent table dependencies, 286 parent-child relationship, 34 pbMDData, 62 Peek method, 393 ReceiveTimeout value, critical requirement for, 390 PeekCurrent method, 393 PeekNext method, 393 PerlScript and Variant datatype, 150–153 arrays, 161 ASP pages, enabling support within, 137 Boolean parameters, passing in, 150, 151 error handling using Win32::OLE, 177 Permission Denied error, ASP component recompile, 19 permission problems, moving ASP components between machines, 26 persistent storage, 75 persisting data, 262–265 as XML, 316–320 Recordset object, definition requirements, 262 with ATL and MFC in C++ ASP components, 581–595 persisting objects, 588, 591 pointer datatype, 429 poolable objects creating, C++, 439 port settings, development environment, 17 POST method, 210, 457 Prepared property, 253 presentation layer, 266, 267 presentation layer and business layer, separation, 446 Private, 182 private message queues, 413 private queue, 551 private queues, 382 creating, 384 creation on local only, 385 private queues, creating, 556 PRIVATE$ token, 556 processXMLQuery method, 309, 314 progid, 142 ProgID (programmatic identifier), 140 ProgIDs, LDAP providers, 351 Project Properties Debug settings, 222 PROPID, 565 Provider argument, 235 proxies for cross-thread (apartment) and cross-context method calls, 112 proxy, 95 public queue, 551 public queues, 382 public queues creating, 554 PublicNotCreatable, 182 Put method, 40, 348 put_Buffer method, 449 put_CharSet method, 451 put_Expires method, 449 put_ExpiresAbsolute method, 449 put_Filter method, 538 put_LCID method, 456 PutRefActiveConnection method, 481 put_ScriptTimeOut method, 463 put_Status method, 450 putTimeout method, 66–68 put_Value method, 452 This is the Title of the Book, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcIX.fm.21459 Page 805 Thursday, February 22, 2001 1:38 PM Index 805 Python, resources for using in ASP, 137 Q queries business objects, 281 processing a result set, 231 queryies, 230–233 QueryInterface method, 74, 80, 445 QueryString collection, 209, 457 queues, 382 creating, 382–386 creating using MSMQ, 553 dot (.), use in pathname, 385 filenames, encryption of, 385, 388 labels, 397 MSMQ, 550 searching for, 386 queues, searching for using MSMQ, 560–568 R RDS (Remote Data Service), 225 readJournal method, 409, 410 readStringMessage method, 390, 392, 410, 572 readXactMessage method, 578 Receive method, 390 ReceiveTimeout value, critical requirement for, 390 ReceiveCurrent method, 393 ReceiveTimeout parameter, 391 necessity to access of queue messages, 390 Record object, 257 Record objects, 497–505 Recordset locking, 244 XML format, saving as, 263 Recordset object, 242–250, 479–486 connection to data source, using, 229 creating, 479 disconnecting a recordset, 481 filtering and sorting the recordset, 485 properties and methods, 479 use of client-side cursors, 262 Recordset object, persisting, 318 recordsets persisting XML to Response objects, 319 saving ADO as XML, 315–320 XML files, saving to, 318 Redirect method, 218 references, passing parameters by, 189 referential integrity, 273 Refresh method, 385 regsvr32.exe, 72 registration of components, 127 Release method, 75, 80 removeGroup method, 361, 542 removeQueue method, 385, 558 removeUser method, 370 removeUserFromGroup method, 374 Request object, 209–214, 444 collections, 209 client certificates, 212 Cookies, 213 resource management, 222 Response object, 199, 214–218, 444 ContentType property, 216 cookies, 217 Expires and ExpiresAbsolute properties, 217 instantiating, 532 methods, properties, and collections, 214 Response object, instantiating in the Acivation methods, 583 Response.Redirect vs Server.Transfer method, 219 role-based security, COM+ applications, 125 RollbackTrans method, 237 rootDSE, 352 round-robin thread assignment, 185 RUNAT attribute, 138 S SafeArray, 211 SAFEARRAY data type, 90 SAFEARRAY datatype, 159, 430 SAMAccountName property, 540 Save method, 245 ADO recordset, saving to XML, 315 saveRsAsXml method, 263 SaveToFile method, 262 saveXMLToDocument method, 316 saveXMLToFile method, 318 saveXMLToResponse method, 319 schema class, 33 This is the Title of the Book, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcIX.fm.21459 Page 806 Thursday, February 22, 2001 1:38 PM 806 Index Schema property, 34 SchemaEnum, 240 SCODE datatype, 430 scope, 142 tag, 138 scripting default language, 58 scripting languages datatypes, management, 146–159 limitations, order of operations with multiple languages, 139 setting default, 137–139 setting for a code block, 138 using two or more in a page, 138 secirity COM+ application role-based, 125 security development environment, 25 MSMQ messages, 412 Security property, 118 selectSingleNode method, 310 sendAttachments method, 336, 519 sendIntrnlXactMsg method, 395 sendJournalMsg method, 408, 410 sendMessage method, IMessage interface, CDO, 510 sendMixedMultiPart method, 332, 515 sendMultiPart method, 329, 512 sendStringMessage method, 389, 570 sendURL method, 324 sendXactMessage method, 576 Serialize method, 588 overriding for CObject class, 589 serializing objects, 588, 591 distributed environments, 595 Serve object CreateObject method vs VBScript’s CreateObject, 141 server applications, 126 server isolation, for debugging, 222 Server object, 218, 445 CreateObject method, 140 encoding methods, 218 serverless binding, 352 servers selection as location to run scripts, 138 server-side scripting, Server.Transfer vs Response.Redirect method, 219 ServerVariables collection, 209, 457 Session object, 206–209, 444 internationalization of applications, 208 properties, 206 threading, 207 threading issues, 223 Session objects, 142 SessionID, 207 Set statement, 243 SetAbort method, 117, 197, 432 setCacheDate, 449 SetComplete method, 117, 197, 401, 432 SetDeactivateOnReturn method, 120 SetInfo method, 349, 541 setInfo method, 585 SetMyTransactionVote method, 120 setScore method, 592 SetSearchPreference method, 548 set_Timeout method, 456 short datatype, 429 showPage method, 246, 482 showPageInfo method, 252, 254, 493 showPages method, 251, 491 showPagesWithParm method, 495 showPagesWithParms method, 254 showProperties method, 239 Connection object, C++ components, 474 showSpecificPage method, 248, 485 showTypes method, 488 showUsers method, 536 showVariables method, 458 single-threaded components ASP, problems with, 99 single-threaded model, 424 SingleUse, 182 smart pointers, 467 CDO in C++ ASP components, 508 instantiating Connection pointer, 475 placeholder for, 560, 562 SMTP default drop mail folder, 339 SMTP drop directory, 521 socket pooling, IIS 5.0, 18 Sort property, 248, 479 source journaling, 408 tag, 306 sp_getpages stored procedure, 494 This is the Title of the Book, eMatter Edition Copyright © 2001 O’Reilly & Associates, Inc All rights reserved ,aspcIX.fm.21459 Page 807 Thursday, February 22, 2001 1:38 PM Index 807 STA (single-threaded apartment) in-process components, 184 single-threaded apartments (STA), 102 standard Internet user, 259 standard I/O including support in C++ components, 480