You are previewing ASP in a Nutshell, 2nd Edition.
O'Reilly logo
ASP in a Nutshell, 2nd Edition

Book Description

ASP in a Nutshell provides the high-quality reference documentation that web application developers really need to create effective Active Server Pages. It focuses on how features are used in a real application and highlights little-known or undocumented features. This book also includes an overview of the interaction between the latest release of Internet Information Server (version 5) and ASP 3.0, with an introduction to the IIS object model and the objects it comprises. The examples shown in this section and throughout the book are illustrated in VBScript. The main components of this book are:

  • Active Server Pages Introduction. Brief overview of the ASP application paradigm with examples in VBScript. Also included is an introduction to Microsoft's Internet Information Server 5.0, the IIS object model, and the objects that it comprises.

  • Object Reference. Each object is discussed in the following manner: descriptions, properties, collections, methods, events, accessory files/required DLLs, and remarks, including real-world uses, tips and tricks, and author's experience (where applicable). The objects--Application, Response, Request, Server, Session, ObjectContext, and ASPError, as well as ASP Directives, Global.ASA, and Server-Side Includes--all follow this paradigm.

  • Component Reference. This section follows the same paradigm found in Object Reference. The discussion covers all of the additional components included with IIS, such as ActiveX Data Objects, the Ad Rotator, the Browser capabilities component, the File System Object, and more.

  • Appendixes. Gives examples in one or two objects and components using Perl, REXX, and Python in ASP.

  • Like other books in the "In a Nutshell" series this book offers the facts, including critical background information, in a no-nonsense manner that users will refer to again and again. It is a detailed reference that enables even experienced web developers to advance their ASP applications to new levels.

    Table of Contents

    1. ASP in a Nutshell, 2nd Edition
    2. A Note Regarding Supplemental Files
    3. Preface
      1. Who Is This Book for?
      2. How to Use This Book
      3. How This Book Is Structured
      4. Conventions Used in This Book
      5. Comments and Questions
      6. Acknowledgments for the Second Edition
      7. Acknowledgments from the First Edition
    4. I. Introduction to Active Server Pages
      1. 1. Active Server Pages:An Introduction
        1. 1.1. The Static Internet
        2. 1.2. The Dynamic Internet Part I: CGI Applications
        3. 1.3. The Dynamic Internet Part II: ISAPI
        4. 1.4. Active Server Pages and Active Server Pages 2.0
        5. 1.5. ASP: A Demonstration
        6. 1.6. The ASP Object Model
      2. 2. Active Server Pages:Server-Side Scripting
        1. 2.1. Client-Side Scripting
        2. 2.2. Server-Side Scripting
        3. 2.3. ASP Functions
        4. 2.4. Scripting Languages
      3. 3. Extending Active Server Pages
    5. II. Object Reference
      1. 4. Application Object
        1. 4.1. Comments/Troubleshooting
        2. 4.2. Collections Reference
          1. Contents Collection
        3. 4.3. Contents Collection Methods
          1. Remove
          2. RemoveAll
          3. StaticObjects
        4. 4.4. Methods Reference
          1. Lock
          2. Unlock
        5. 4.5. Events Reference
          1. OnEnd
          2. OnStart
      2. 5. ASPError Object
        1. 5.1. Comments/Troubleshooting
        2. 5.2. Properties Reference
          1. ASPCode
          2. ASPDescription
          3. Category
          4. Column
          5. Description
          6. File
          7. Line
          8. Number
          9. Source
        3. 5.3. ASPError Example
      3. 6. ObjectContext Object
        1. 6.1. Comments/Troubleshooting
        2. 6.2. Methods Reference
          1. SetAbort
          2. SetComplete
        3. 6.3. Events Reference
          1. OnTransactionAbort
          2. OnTransactionCommit
      4. 7. Request Object
        1. 7.1. How HTTP Works
          1. 7.1.1. HTTP: A Simple Example
          2. 7.1.2. HTTP Request Types
          3. 7.1.3. Form Submission
          4. 7.1.4. HTTP Request and Response
            1. 7.1.4.1. The request
            2. 7.1.4.2. The response
          5. 7.1.5. The HTTP Request and the ASP Request Object
        2. 7.2. The ASP Request Object
        3. 7.3. Comments/Troubleshooting
        4. 7.4. Properties Reference
          1. TotalBytes
        5. 7.5. Collections Reference
          1. ClientCertificate
          2. Cookies
          3. Form
          4. QueryString
          5. ServerVariables
        6. 7.6. Methods Reference
          1. BinaryRead
      5. 8. Response Object
        1. 8.1. Comments/Troubleshooting
        2. 8.2. Properties Reference
          1. Buffer
          2. CacheControl
          3. Charset
          4. ContentType
          5. Expires
          6. ExpiresAbsolute
          7. IsClientConnected
          8. PICS
          9. Status
        3. 8.3. Collections Reference
          1. Cookies
        4. 8.4. Methods Reference
          1. AddHeader
          2. AppendToLog
          3. BinaryWrite
          4. Clear
          5. End
          6. Flush
          7. Redirect
          8. Write
      6. 9. Server Object
        1. 9.1. Comments/Troubleshooting
        2. 9.2. Properties Reference
          1. ScriptTimeout
        3. 9.3. Methods Reference
          1. CreateObject
          2. Execute
          3. GetLastError
          4. HTMLEncode
          5. MapPath
          6. Transfer
          7. URLEncode
      7. 10. Session Object
        1. 10.1. Comments/Troubleshooting
        2. 10.2. Properties Reference
          1. CodePage
          2. LCID
          3. SessionID
          4. Timeout
        3. 10.3. Collections Reference
          1. Contents Collection
          2. Remove
          3. RemoveAll
          4. StaticObjects Collection
        4. 10.4. Methods Reference
          1. Abandon
        5. 10.5. Events Reference
          1. Session_OnEnd
          2. Session_OnStart
      8. 11. Preprocessing Directives, Server-Side Includes, and GLOBAL.ASA
        1. 11.1. Preprocessing Directives
          1. 11.1.1. Preprocessing Directives: Comments/Troubleshooting
        2. 11.2. Preprocessing Directives Reference
          1. CODEPAGE
          2. ENABLESESSIONSTATE
          3. LANGUAGE
          4. LCID
          5. TRANSACTION
        3. 11.3. Server-Side Includes
          1. 11.3.1. Server-Side Includes: Comments/Troubleshooting
            1. #include
        4. 11.4. GLOBAL.ASA
          1. 11.4.1. GLOBAL.ASA: Comments/Troubleshooting
        5. 11.5. GLOBAL.ASA Reference
          1. Application Object Events and Application Scope
          2. Session Object Events and Session Scope
          3. Type Library Declarations
    6. III. Installable Component Reference
      1. 12. ActiveX Data Objects 2.6
        1. 12.1. Accessory Files/Required DLL Files
        2. 12.2. Instantiating Active Data Objects
          1. 12.2.1. Example
        3. 12.3. Comments/Troubleshooting
        4. 12.4. Object Model
          1. 12.4.1. Command Object
          2. 12.4.2. Connection Object
          3. 12.4.3. Error Object
          4. 12.4.4. Field Object
          5. 12.4.5. Parameter Object
          6. 12.4.6. Property Object
          7. 12.4.7. Record Object
          8. 12.4.8. Recordset
          9. 12.4.9. Stream Object
        5. 12.5. Properties Reference
          1. AbsolutePosition (Recordset Object)
          2. ActiveConnection (Command, Recordset Objects)
          3. BOF (Recordset Object)
          4. CommandText (Command Object)
          5. CommandTimeout (Command, Connection Objects)
          6. CommandType (Command Object)
          7. ConnectionString (Connection Object)
          8. ConnectionTimeout (Connection Object)
          9. CursorType (Recordset Object)
          10. Description (Error Object)
          11. EOF (Recordset Object)
          12. Filter (Command, Recordset Objects)
          13. MaxRecords (Recordset Object)
          14. Name (Command, Field, Parameter, Property Objects)
          15. Number (Error Object)
          16. RecordCount (Recordset Object)
          17. Source (Error Object)
          18. Source (Recordset Object)
        6. 12.6. Collections Reference
          1. Errors Collection
        7. 12.7. Methods Reference
          1. AddNew (Recordset Object)
          2. Clone (Recordset Object)
          3. Close (Connection Object, Recordset Object)
          4. Delete (Parameter Object, Recordset Object)
          5. Execute (Command Object)
          6. Execute (Connection Object)
          7. Move (Recordset Object)
          8. MoveFirst, MoveLast, MoveNext, MovePrevious (Recordset Object)
          9. NextRecordset (Command Object, Recordset Object)
          10. Open (Connection Object)
          11. Open (Recordset Object)
          12. Requery (Recordset Object)
          13. Resync (Recordset Object)
          14. Supports (Recordset Object)
          15. Update (Command Object, Recordset Object)
      2. 13. Ad Rotator Component
        1. 13.1. Accessory Files/Required DLL Files
          1. 13.1.1. Adrot.dll
          2. 13.1.2. Redirection File
          3. 13.1.3. Rotator Schedule File
        2. 13.2. Instantiating the Ad Rotator
          1. 13.2.1. Example
        3. 13.3. Comments/Troubleshooting
        4. 13.4. Properties Reference
          1. Border
          2. Clickable
          3. TargetFrame
        5. 13.5. Methods Reference
          1. GetAdvertisement
        6. 13.6. Ad Rotator Example
      3. 14. Browser Capabilities Component
        1. 14.1. Accessory Files/Required DLL Files
          1. 14.1.1. BrowsCap.dll
          2. 14.1.2. BrowsCap.ini
        2. 14.2. Instantiating the Browser Capabilities Component
          1. 14.2.1. Example
        3. 14.3. Comments/Troubleshooting
        4. 14.4. Properties Reference
          1. PropertyName (Customizable)
        5. 14.5. Retrieving Browser Information from Cookies
      4. 15. Collaboration Data Objects for Windows NT Server
        1. 15.1. Accessory Files/Required DLL Files
        2. 15.2. Instantiating Collaboration Data Objects
          1. 15.2.1. Example
        3. 15.3. Comments/Troubleshooting
        4. 15.4. The CDO Object Model
          1. 15.4.1. Common Properties
          2. 15.4.2. AddressEntry Object
          3. 15.4.3. Attachment Object
          4. 15.4.4. Attachments Collection
          5. 15.4.5. Folder Object
          6. 15.4.6. Message Object
          7. 15.4.7. Messages Collection
          8. 15.4.8. NewMail Object
          9. 15.4.9. Recipient Object
          10. 15.4.10. Recipients Collection
          11. 15.4.11. Session Object
        5. 15.5. NewMail Object Properties Reference
          1. Bcc
          2. Body
          3. BodyFormat
          4. Cc
          5. ContentBase
          6. ContentLocation
          7. From
          8. Importance
          9. MailFormat
          10. Subject
          11. To
          12. Value
          13. Version
        6. 15.6. Methods Reference
          1. AttachFile
          2. AttachURL
          3. Send (NewMail Object)
          4. SetLocaleIDs (NewMail Object)
      5. 16. Content Linking Component
        1. 16.1. Accessory Files/Required DLL Files
          1. 16.1.1. Netlink.DLL
          2. 16.1.2. Content Linking List
        2. 16.2. Instantiating a Content Linking Object
          1. 16.2.1. Example
        3. 16.3. Comments/Troubleshooting
        4. 16.4. Methods Reference
          1. GetListCount
          2. GetListIndex
          3. GetNextDescription
          4. GetNextURL
          5. GetNthDescription
          6. GetNthURL
          7. GetPreviousDescription
          8. GetPreviousURL
        5. 16.5. Content Linking Component Example
      6. 17. Content Rotator Component
        1. 17.1. Accessory Files/Required DLL Files
          1. 17.1.1. Controt.DLL
          2. 17.1.2. Content Schedule File
        2. 17.2. Instantiating the Content Rotator Component
          1. 17.2.1. Example
        3. 17.3. Comments/Troubleshooting
        4. 17.4. Methods Reference
          1. ChooseContent
          2. GetAllContent
      7. 18. Counters Component
        1. 18.1. Accessory Files/Required DLL Files
        2. 18.2. Instantiating the Counters Component
          1. 18.2.1. Example
        3. 18.3. Comments/Troubleshooting
        4. 18.4. Methods Reference
          1. Get
          2. Increment
          3. Remove
          4. Set
      8. 19. File Access Component
        1. 19.1. Accessory Files/Required DLL Files
        2. 19.2. Instantiating Installable Components
          1. 19.2.1. Example
        3. 19.3. Comments/Troubleshooting
        4. 19.4. Object Model
          1. 19.4.1. Drive Object
          2. 19.4.2. Drives Collection
          3. 19.4.3. File Object
          4. 19.4.4. Files Collection
          5. 19.4.5. FileSystemObject Object
          6. 19.4.6. Folder Object
          7. 19.4.7. Folders Collection
          8. 19.4.8. TextStream Object
        5. 19.5. Properties Reference
          1. AtEndOfLine (TextStream Object)
          2. AtEndOfStream (TextStream Object)
          3. Attributes (File Object, Folder Object)
          4. AvailableSpace (Drive Object)
          5. DateCreated (File Object, Folder Object)
          6. Drive (File Object, Folder Object)
          7. FileSystem (Drive Object)
          8. IsReady (Drive Object)
          9. IsRootFolder (Folder Object)
          10. ParentFolder (File Object, Folder Object)
        6. 19.6. Methods Reference
          1. Close (TextStream Object)
          2. Copy (File Object, Folder Object)
          3. CopyFolder (FileSystemObject Object)
          4. CreateFolder (FileSystemObject Object)
          5. Delete (File Object, Folder Object)
          6. GetBaseName (FileSystemObject Object)
          7. GetParentFolderName (FileSystemObject Object)
          8. GetSpecialFolder (FileSystemObject Object)
          9. MoveFolder (FileSystemObject Object)
          10. OpenAsTextStream (File Object)
          11. ReadLine (TextStream Object)
          12. Write (TextStream Object)
          13. WriteLine (TextStream Object)
      9. 20. Logging Utility Component
        1. 20.1. Accessory Files/Required DLL Files
        2. 20.2. Instantiating the Logging Utility Component
          1. 20.2.1. Example
        3. 20.3. Comments/Troubleshooting
        4. 20.4. Properties Reference
          1. BytesReceived
          2. BytesSent
          3. ClientIP
          4. Cookie
          5. CustomFields
          6. DateTime
          7. Method
          8. ProtocolStatus
          9. ProtocolVersion
          10. Referer
          11. ServerIP
          12. ServerName
          13. ServerPort
          14. ServiceName
          15. TimeTaken
          16. URIQuery
          17. URIStem
          18. UserAgent
          19. UserName
          20. Win32Status
        5. 20.5. Methods Reference
          1. AtEndOfLog
          2. CloseLogFiles
          3. OpenLogFile
          4. ReadFilter
          5. ReadLogRecord
          6. WriteLogRecord
        6. 20.6. Logging Utility Component Example
      10. 21. MyInfo Component
        1. 21.1. Accessory Files/Required DLL Files
        2. 21.2. Comments/Troubleshooting
        3. 21.3. Properties Reference
          1. [All Properties]
      11. 22. Page Counter Component
        1. 22.1. Accessory Files/Required DLL Files
        2. 22.2. Instantiating the Page Counter Component
          1. 22.2.1. Example
        3. 22.3. Comments/Troubleshooting
        4. 22.4. Methods Reference
          1. Hits
          2. PageHit
          3. Reset
      12. 23. Permission Checker Component
        1. 23.1. Accessory Files/Required DLL Files
        2. 23.2. Instantiating the Permission Checker
          1. 23.2.1. Example
        3. 23.3. Comments/Troubleshooting
        4. 23.4. Methods Reference
          1. HasAccess
      13. 24. Tools Component
        1. 24.1. Accessory Files/Required DLL Files
        2. 24.2. Instantiating the Tools Component
          1. 24.2.1. Example
        3. 24.3. Comments/Troubleshooting
        4. 24.4. Methods Reference
          1. FileExists
          2. Owner
          3. PluginExists
          4. ProcessForm
          5. Random
    7. IV. Appendixes
      1. A. ASP Intrinsic Objects Member Summary
      2. B. Converting CGI/WinCGI Applications into ASP Applications
        1. B.1. The CGI Application
        2. B.2. The Perl CGI Script
        3. B.3. The Visual Basic CGI Application
        4. B.4. The Active Server Pages
        5. B.5. Converting Environment Variables
      3. C. ASP on Alternative Platforms
        1. C.1. Chili!ASP from Chili!Soft
          1. C.1.1. Comments
          2. C.1.2. Contact Information
        2. C.2. Instant ASP (iASP) from Halcyon Software
          1. C.2.1. Comments
          2. C.2.2. Contact Information
        3. C.3. OpenASP from the ActiveScripting Organization
          1. C.3.1. Comments
          2. C.3.2. Contact Information
      4. D. Configuration of ASP Applications on IIS
        1. D.1. Microsoft Management Console and the Metabase
          1. D.1.1. ASP Application Configuration
            1. D.1.1.1. Unloading ASP Applications
          2. D.1.2. ASP Error Handling Configuration
    8. Colophon
    9. Copyright