ASP in a Nutshell

ASP in a Nutshell

4.0 4
by Keyton Weissinger, Ron Petrusha
     
 

View All Available Formats & Editions

Active Server Pages (ASP) has become a standard for developing server-side Web applications. Prior to the development of ASP and other earlier scripting solutions, such as Sun's Java, Netscape's JavaScript, and Microsoft's VBScript, all information served to the client's browser was static — the Web server did not dynamically generate any part of the site's

Overview

Active Server Pages (ASP) has become a standard for developing server-side Web applications. Prior to the development of ASP and other earlier scripting solutions, such as Sun's Java, Netscape's JavaScript, and Microsoft's VBScript, all information served to the client's browser was static — the Web server did not dynamically generate any part of the site's content. ASP allows Web developers to dynamically generate browser-neutral content.ASP in a Nutshell provides the high-quality documentation that developers really need to create effective ASP applications. It focuses on how features are used in a real application and highlights little-known or undocumented features as well. This book also includes an overview of the interaction of the latest release of Internet Information Server (version 4) and ASP, with an introduction to the IIS object model and the objects it comprises. The examples given in this section and throughout the book are illustrated in VBScript.This book is written for Web developers with an extensive knowledge base and years of experience behind them. 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.The main components covered in this book are:

  • Active Server Pages Introduction. Brief overview of the ASP application paradigm with examples in VBScript. Also an introduction to Microsoft's Internet Information Server 4.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, as well as ASP Directives, Global.ASA, and SS Includes all follow this paradigm.
  • Component Reference. This section follows the same paradigm detailed in Object Reference. The discussion covers Active Data Objects, Ad Rotator, Browser capabilities, File Access, Tools, and more.
  • Appendices. Gives examples in one or two objects and components using Perl, REXX, and Python in ASP.The information in this book is written in a no-nonsense manner. Readers will find high-quality documentation and useful examples throughout. It is a detailed reference that provides Web developers with the information they need to develop effective ASP applications.

Editorial Reviews

The Barnes & Noble Review
If you're an experienced developer working with ASP 3 and IIS 5.0, here's the authoritative, real-world ASP reference you'll use every day. Building on his best-selling first edition, A. Keyton Weissinger offers detailed insight for making the most of ASP 3 and the IIS object model, followed by a comprehensive reference focusing on real-world applications and illuminating underpublicized ASP features that offer you powerful opportunities.

ASP in a Nutshell, Second Edition presents detailed coverage of every key ASP object: when you'd use it, how it works, its properties, collections, methods, events, any accessory files or DLLs you'll need, and (in many cases) tricks from the author's personal grab-bag. Weissinger introduces preprocessing directives, server-side includes, GLOBAL.ASA, and much more. You'll also learn how to use the powerful components that ship with ASP 3.0 and IIS 5.0, including its ADO 2.6 support and prebuilt components for ad and content rotation, browsing, CDO-based workflow and messaging, content linking, page counters, file access, logging, permission checking, and more.

Four valuable appendices cover ASP Intrinsic Objects, conversion of CGI/WinCGI applications to ASP, ASP on alternative platforms (e.g., ChiliSoft); and configuring ASP applications on IIS.
Bill Camarda, bn.com editor

Library Journal
ASP (active server pages) technology is a model of dynamic information service, which means the user gets customized information rather than static, designed-for-everyone html pages. ASP also has an open-source initiative, which gives legs to ASP outside of Microsoft; presently it runs on everything from Microsoft to Unix/Linux, Mac, and SGI. This manual is not for beginners, but this is a highly lucrative area at the moment. Copyright 1999 Cahners Business Information.
Booknews
This reference guide for developers shows how particular object model features are used in a real application, and highlights little- known or undocumented aspects. The second edition is updated to cover ASP 3.0 and IIS 5.0. Annotation c. Book News, Inc., Portland, OR (booknews.com)

Product Details

ISBN-13:
9781565924901
Publisher:
O'Reilly Media, Incorporated
Publication date:
02/08/1999
Series:
In a Nutshell (O'Reilly) Series
Edition description:
Older Edition
Pages:
426
Product dimensions:
5.96(w) x 8.93(h) x 0.85(d)

Read an Excerpt


Chapter 6: ObjectContext Object

As of version 2.0, an important feature of Active Server Pages is the ability to create a transactional script: one whose constituent code segments all succeed completely or fail as a group. For example, using such a script, one section of code could remove a record from an inventory table, and a second section could add a record to a sales log table. However, only if both sections of code succeed does the script itself succeed. If the removal of the inventory record or the addition of the sales record fails, the script itself fails. Both processes are rolled back: the deleted record, if it was removed, is added back into the database, and the sales record, if it was added, is removed from the sales log table. This ability to wrap several functions in a single transactional unit that succeeds or fails as a whole is an important improvement in the power of ASP applications. Previously, all transactions relied on database transaction support.

ASP application transactions are controlled by Windows 2000 COM+ Component Services or Windows NT's Microsoft Transaction Server (MTS). This piece of the BackOffice suite allows control over all database actions coded to use it. Support for transactional scripts is built into IIS and Personal Web Server and does not require any special setup. Without COM+ Component Services' or, in ASP 2.0, MTS transactional support, your applications would have to track all database changes manually and roll back all database actions by hand, keeping track of multiuser and concurrency issues, etc. MTS or COM+ Component Services gives this support for very little extra coding--as long as the database your application is connected to supports the XA protocol from the X/Open consortium. Note that this support is currently limited to SQL Server. Note, also, that this means that file actions are not yet supported--or at least, not automatically.

ASP's support of transactions is coded through the use of the ObjectContext object, which represents the actual ObjectContext object of COM+ Component Services itself. By calling methods of the ObjectContext object and coding its events, you can create a transactional script with only a few more lines of code.

To declare all the script on a given page to be transactional, simply add the following line of code as the first line in your script:

<%@ TRANSACTION = Required %>

For more details on the TRANSACTION ASP directive, see Chapter 11, Preprocessing Directives, Server-Side Includes, and GLOBAL.ASA. Here it is important only that this line be the first in your script; including this line alerts the web server to use Component Services to ensure that the script succeeds or fails as a whole.

To commit the transaction or abort it, you simply call the SetComplete or SetAbort methods of the ObjectContext object, respectively. If you are dealing with a complex transaction containing segments of code that are not supported by Component Services (notably file actions), you can specially code for these actions in the ObjectContext events OnTransactionCommit and OnTransactionAbort. There are examples of all of these methods and event procedures in the reference section later in this chapter.

ObjectContext Object Summary

Properties
None
Collections
None
Methods
SetAbort
SetComplete
Events
OnTransactionAbort
OnTransactionCommit

Comments/Troubleshooting

There are currently two very important limitations in constructing transactional scripts:

  • Only database actions are supported, and only databases that support the XA protocol are supported by COM+ Component Services or MTS.

  • A transaction cannot span more than one ASP page. For this reason, you must be very careful in creating your pages: they must include all the actions required by your transactions but not be so large as to slow the processing of the page by too large a percentage...

Meet the Author

Weissinger is the Director for Enterprise Solutions at a start-up company in Atlanta.

Customer Reviews

Average Review:

Write a Review

and post it to your social network

     

Most Helpful Customer Reviews

See all customer reviews >

ASP in a Nutshell 4 out of 5 based on 0 ratings. 8 reviews.
Guest More than 1 year ago
This is truly an excellent book. I have read both editions and loved them. This is the only ASP 'classic' title that you will ever need and I can assure you from experience that the examples definitely work. The Wrox books dwell on trivial subjects ad nauseum. If you have experience with programming, you can plough through this and start writing good ASP code in no time. If you pick up VBScript in a Nutshell, you will be unstoppable in your ASP coding.
Guest More than 1 year ago
this book is good for people who already have some knowledge about asp. i wouldn't recommend it for beginners. it requires a lot of reading and there is so much text written to actually extract some meaningful iformation.
Guest More than 1 year ago
I never saw asp code before and with this book I understand and was able to make a family tree site for my family.
Guest More than 1 year ago
This is a good starting point. All you need is PWS and have some understanding of HTML with VB scripting and this will put in right path. Good examples as well. This book has been sitting on my shelves for a year. I just have been waiting for the right time to apply ASP. And in no time I was supporting DB server for our dept's web page.
Guest More than 1 year ago
If you use ASP in your development you must have this book! Excellent quick reference!
Guest More than 1 year ago
A gotta-have! In its unassuming text and its relatively handy size.ASP in a Nutshell is a great reference book, with detailed descriptions and examples of the Objects and Components of ASP
Guest More than 1 year ago
This book has been an amazing boost to my ability to use ASP and quickly turn out web apps! A gotta-have! In its unassuming text and its relatively handy size, it is a perfect companion!
Guest More than 1 year ago
I have purchased three other ASP programming books before reading this one. After reviewing the code samples in this book, I can not recommend this book be used by anyone serious about programming. The sample code does not work and the advice is either outdated or simply wrong. It is painfully obvious that this coder has very little time actually using the code.