Designing Active Server Pages

Total Page:16

File Type:pdf, Size:1020Kb

Designing Active Server Pages Designing Active Server Pages Designing Active Server Pages Scott Mitchell Beijing • Cambridge • Farnham • Köln • Paris • Sebastopol • Taipei • Tokyo Designing Active Server Pages by Scott Mitchell Copyright © 2000 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: Mary Sheehan Cover Designer: Edie Freedman Printing History: September 2000: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly & Associates, Inc. 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. ActiveX, JScript, Microsoft, Microsoft Internet Explorer, Visual Basic, Visual C++, Windows, and Windows NT are registered trademarks of Microsoft Corporation. The association between the image of a night monkey and the topic of designing Active Server Pages 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. Library of Congress Cataloging-in-Publication Data Mitchell, Scott Designing Active Server Pages/Scott Mitchell p. cm. ISBN 0-596-00044-8 (alk. paper) 1. Active Server Pages. 2. Web sites --Design. 3. Web publishing I. Title. TK5105.8885.A26 M58 2000 005.7'2--dc21 00-062331 ISBN: 0-596-00044-8 [M] About the Author Scott Mitchell is the cofounder of one of the most popular ASP resource destina- tions on the Internet, http://www.4guysfromrolla.com. Originally started as a college project, the site quickly blossomed into a community of serious web developers. 4Guys attracts tens of thousands of experienced ASP developers every day; unlike other communities, it offers a warm welcome and advice for those new to Active Server Pages. In addition to http://www.4guysfromrolla.com, Scott has extensive experience building real-world web sites using Active Server Pages, including building intranet tools for Microsoft’s Office Group. 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 Designing Active Server Pages is a night monkey (Aotus). The night monkey, also known as the owl monkey, is found in South America, specifically in Northern Argentina, Bolivia, Brazil, Colombia, Costa Rica, Equador, Guyana, Panama, Paraguay, Peru, and Venezuela. It lives in trees and subsists on a diet of fruit, leaves, insects, flowers, and bird eggs. As its name suggests, it is nocturnal and in fact, is the only nocturnal member of the monkey species. It is one of the smaller primates; adults usually weigh about two pounds and are about 11–16 inches long. A night monkey’s eyes are larger than any other South American primate’s and are a great asset to their nighttime lifestyle. Night monkeys are monogamous and travel in family packs. The mother cares for a newborn in its first week of life; after that, the father takes over all parental duties except for nursing. The father carries the baby for approximately six months. The baby begins easing more into family play and foraging for food on its own in the second half of its first year. A night monkey reaches maturity between two and three years of age, at which point it leaves its family group and strikes out on its own. Mary Sheehan was the production editor and proofreader for Designing Active Server Pages. Nancy Kotary was the production manager. Ellie Maden was the copyeditor, and Colleen Gorman and Mary Anne Weeks Mayo provided quality control. John Bickelhaupt and Brenda Miller wrote the index. Edie Freedman designed the cover of this book, using an image from Johnson’s Natural History. Emma Colby produced the cover layout with QuarkXPress 4.1 using Adobe’s ITC Garamond font. Alicia Cech and David Futato designed the interior layout based on a series design by Nancy Priest. Mike Sierra implemented the design in FrameMaker 5.5.6. The text and heading fonts are ITC Garamond Light and Garamond Book. The illustra- tions that appear in the book were produced by Robert Romano using Macromedia FreeHand 8 and Adobe Photoshop 5. This colophon was written by Mary Sheehan. 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. Table of Contents Preface ................................................................................................................... vii 1. Introduction ................................................................................................ 1 What Is Application Design? ............................................................................ 1 What’s Wrong with ASP Design? ..................................................................... 3 Why Hasn’t ASP Design Advanced? ................................................................ 4 What Can Be Done to Improve ASP Design? ................................................. 5 Further Reading .............................................................................................. 18 2. Choosing a Server-Side Scripting Language ................................. 19 The Popularity of VBScript ............................................................................ 19 Specifying the Scripting Language ................................................................ 20 Creating ASP Pages with JScript .................................................................... 25 Creating ASP Pages with PerlScript ............................................................... 31 Creating ASP Pages with Python ................................................................... 37 Further Reading .............................................................................................. 37 3. Exception Handling ............................................................................... 39 A Bit of Terminology ..................................................................................... 40 Detecting When Exceptions Occur ............................................................... 42 Responding to Exceptions ............................................................................. 65 Creating Custom HTTP Error Pages .............................................................. 73 Further Reading .............................................................................................. 77 v Oracle 8i Internal Services for Waits, Latches, Locks, and Memory, eMatter Edition Copyright © 2000 O’Reilly & Associates, Inc. All rights reserved. vi Table of Contents 4. Regular Expressions, Classes, and Dynamic Evaluation and Execution ................................................................................................... 78 Using the RegExp Object ............................................................................... 79 Using Object-Oriented Programming with VBScript .................................... 85 Using Dynamic Evaluation and Execution ................................................... 99 Further Reading ............................................................................................ 103 5. Form Reuse ............................................................................................. 104 The Importance of Code Reuse .................................................................. 104 A Primer on Form Use ................................................................................. 106 Form Validation ............................................................................................ 111 Creating Reusable Server-Side Form Validation Routines .......................... 116 Developing Reusable Form Creation Routines ........................................... 124 The Practicality of Reuse ............................................................................. 136 Further Reading ............................................................................................ 137 6. Database Reuse ..................................................................................... 138 Examining Database Usage ......................................................................... 138 The Building Blocks for Creating Reusable Administration Pages ............ 140 Creating Reusable Administration Pages .................................................... 149 Further Reading ............................................................................................ 246 7. Using Components ............................................................................... 247 COM—A Quick Overview ........................................................................... 248 Lesser-Known Microsoft COM Components ............................................... 249 Enhancing Microsoft’s COM Components .................................................. 275 Building Components .................................................................................. 276 Further Reading ...........................................................................................
Recommended publications
  • Active Server Pages (ASP)
    Active Server Pages (ASP) Outline 11.1 Introduction 11.2 How Active Server Pages Work 11.3 Client-side Scripting versus Server-side Scripting 11.4 Using Personal Web Server or Internet Information Server 11.5 A Simple ASP Example 11.6 Server-side ActiveX Components 11.7 File System Objects 11.8 Session Tracking and Cookies 11.9 Accessing a Database from an Active Server Page 11.10 Case Study: A Product Catalog 11.1 Introduction • Active Server Pages (ASP) – Processed in response to client request – ASP file contains HTML and scripting code – VBScript de facto language for ASP scripting • Other languages can be used – JavaScript – .asp file extension – Microsoft-developed technology – Send dynamic Web content • HTML • DHTML • ActiveX controls • Client-side scripts • Java applets 11.2 How Active Server Pages Work • Client sends request – Server receives request and directs it to ASP – ASP processes, then returns result to client • HTTP request types – Request methods • GET – Gets (retrieves) information from server – Retrieve HTML document or image • POST – Posts (sends) data to server – Send info from HTML form » Client-entered data » Info to search Internet » Query for a database » Authentication info 11.2 How Active Server Pages Work (II) • Browsers often cache Web pages – Cache: save on disk – Typically do not cache POST response • Next POST request may not return same result • Client requests ASP file – Parsed (top to bottom) by ActiveX component asp.dll • ActiveX component: server-side ActiveX control that usually does not have GUI
    [Show full text]
  • Active Server Pages Architecture
    Active Server Pages Architecture Li Yi South Bank University Contents 1. Introduction ...................................................................................................................................... 2 1.1 Host-based databases ............................................................................................................... 2 1.2 Client/server databases ............................................................................................................ 2 1.3 Web databases........................................................................................................................... 3 2. Active Server Pages ........................................................................................................................ 5 2.1 ASP Components ...................................................................................................................... 6 2.2 ADO and Database................................................................................................................... 7 2.3 The steps of executing a query ............................................................................................. 11 3 ASP Attributes ................................................................................................................................ 12 References:.......................................................................................................................................... 13 1 1. Introduction The development of databases always comes
    [Show full text]
  • Implementing OGC Web Map Service Client Applications Using JSP, JSTL and XMLC
    Implementing OGC Web Map Service Client Applications Using JSP, JSTL and XMLC Hao Ding , Richard Pascoe & Neville Churcher Department of Computer Science University of Canterbury. Christchurch, New Zealand Phone: +64 3 364-2362 Fax: +64 3 364-2569 Email: [email protected] , {richard, neville}@cosc.canterbury.ac.nz Presented at SIRC 2002 – The 14th Annual Colloquium of the Spatial Information Research Centre University of Otago, Dunedin, New Zealand th December 3-5 2002 ABSTRACT Java technologies are widely used in web application development. In this paper are described three approaches to developing Java-based web applications and our experiences with applying each to the development of client that interact with servers implementing the OGC (Open GIS Consortium) Web Map Service (WMS) specification. Also described is the installation and configuration of open source software that implements the WMS specification. The paper is concluded with some preliminary insights into when one of the three approaches to WMS client implementation is more suited to another. Keywords and phrases: WMS, JSP, JSTL, XMLC, map layer, web map server 1.0 INTRODUCTION Of the many technologies, such as Common Gateway Interface (CGI), Active Server Pages (ASP), JavaServer Pages (JSP), that are used to develop web applications, three are of particular interest to the research presented here. These three technologies or approaches to developing clients that utilise web services are JavaServer Pages (JSP), JSP with the use of tags from the JSP Standard Tag Library (JSTL), and the eXtensible Markup Language Compiler (XMLC). JSP is a more convenient way to write Java servlets, and allows the insertion of Java code directly into static HTML (Hypertext Markup Language) pages.
    [Show full text]
  • Tool Support for Computer Role-Playing Game Programming: Foundations, Guidelines and Applications
    Tampereen teknillinen yliopisto. Julkaisu 1237 Tampere University of Technology. Publication 1237 Juha-Matti Vanhatupa Tool Support for Computer Role-Playing Game Programming: Foundations, Guidelines and Applications Thesis for the degree of Doctor of Science in Technology to be presented with due permission for public examination and criticism in Tietotalo Building, Auditorium TB222, at Tampere University of Technology, on the 17th of October 2014, at 12 noon. Tampereen teknillinen yliopisto - Tampere University of Technology Tampere 2014 ISBN 978-952-15-3341-9 (printed) ISBN 978-952-15-3393-8 (PDF) ISSN 1459-2045 Abstract Computer role-playing games (CRPGs) are a genre of computer games, which aim at providing similar player experience than their ancestors, paper-and- pen role-playing games. For a type of digital games, their evolution is already rather long, as the first ones were created in 1980s. Typically CRPGs em- phasize character development and to support this huge fantasy worlds and sophisticated storylines are also present. CRPG development has unique challenges, which derive from these typical features. Content creation is a continuous issue, since huge virtual worlds and long storylines must be filled with content. Personalization is also an important issue, because all fun of creating personalized character is lost if it has no effect into the game. Low starting threshold is important for successful game. It is becoming essential that the player can start playing quickly and she is not required to spent time waiting the installation to be completed. This can be achieved by web-based approach, since web-based games do not require installations.
    [Show full text]
  • Developing an E-Commerce System Using Active Server Pages
    Developing an E-Commerce System Using Active Server Pages Robert W. Ingram Ross-Culverhouse Chair Culverhouse School of Accountancy University of Alabama Box 870220 Tuscaloosa, AL 35487 (205) 348-2907 [email protected] Dale L. Lunsford Assistant Professor Culverhouse School of Accountancy University of Alabama Box 870220 Tuscaloosa, AL 35487 (205) 348-5780 [email protected] August 2002 Developing an E-Commerce System Using Active Server Pages Abstract: This paper describes a case to illustrate analysis, design, and implementation issues involving a multi-tier e-commerce system. The case is designed for use in advanced accounting systems or systems analysis and design courses. The case involves analysis of a sales order system that will be implemented using a web interface and relational database, conceptual design of the system, and implementation of the system. A variety of tasks are involved in the case, but an instructor can select the tasks of relevance in a particular course. Key Words: E-commerce, systems analysis and design, systems development, security. Data Availability: All data and programs described are available from the authors. 1 Developing an E-Commerce System Using Active Server Pages I. Introduction Web-based applications are an important means of accessing business information. E-commerce represents an increasingly important part of the economy and is an obvious source of demand for web-based systems. In addition, companies may use the Internet for internal communications because of the ability of employees to access data from locations throughout the world. Companies like Oracle and SAP are increasingly focusing on the Web as a means of deploying their software products.
    [Show full text]
  • Web Based Applications, Tomcat and Servlets - Lab 3
    CMPUT 391 Database Management Systems Web based Applications, Tomcat and Servlets - Lab 3 - CMPUT 391 – Database Management Systems Department of Computing Science University of Alberta The Basic Web Server Lab 3 CMPUT 391 – Database Management Systems 2 Tomcat and Servlets CGI CGI – Common Gateway Interface Processing forms & Generating dynamic content (early solution ) Spawning an external program, pass the data from the HTML form to the program Limitation: An expensive process (Spawning an external program) Lab 3 CMPUT 391 – Database Management Systems 3 Tomcat and Servlets CGI: Illustration Browser Browser Browser Browser GET Response Form.cgi Web Server Web Server Web Server Web Server Spawn an Read environment external program variables Response Start form.cgi CGfoI rPmr.ocggria m CGI Program CGI Program CteGrIm Pinroagterasm time Lab 3 CMPUT 391 – Database Management Systems 4 Tomcat and Servlets ASP ASP – Active Server Pages Microsoft’s answers to CGI programming ASP page - a Web page with code embedded inside, interpreted by the Web server Using special HTML tags, VBScript/JavaScript code can be inserted Lab 3 CMPUT 391 – Database Management Systems 5 Tomcat and Servlets Servlets Java technology's answer to CGI programming A Java class handling forms on Java Web servers Applet -- a little piece of program (client side) Servlet -- a little piece of program (server side) A servlet can do everything that a CGI program can Running inside the JVM along with the Web server itself Lab 3 CMPUT 391 – Database Management
    [Show full text]
  • Computer Information Systems: Web Applications (CISW) 1
    Computer Information Systems: Web Applications (CISW) 1 CISW 24 Secure Web Server Programming in Python COMPUTER INFORMATION 3 Units (Degree Applicable) Lecture: 54 SYSTEMS: WEB Corequisite: CISW 24L Secure web programming to create user interfaces, extract information APPLICATIONS (CISW) and manage databases, manage files, format reports, and access web CISW 15 Web Site Development servers using Python programming language. Student must be enrolled in 3.5 Units (Degree Applicable, CSU) CISW 24L, a concurrent lab co-requisite. Lecture: 54 Lab: 27 CISW 24L Secure Web Server Programming in Python Laboratory Advisory: CISB 15 or CISB 16 0.5 Units (Degree Applicable) Lab: 27 Plan, develop, implement, publish, and maintain Web sites with a Corequisite: CISW 24 professional visual Web-authoring application, includes working with text and images, internal and external hyperlinks, image maps, tables, Laboratory for secure web programming to create user interfaces, extract Cascading Style Sheets (CSS), Web page content, Web forms, multimedia information and manage databases, manage files, format reports, and objects (Flash text, Flash buttons, sounds, and video), interactions and access web servers using Python programming language. Student must behaviors, and Web page templates. Principles of Web site structures, be enrolled in CISW 24, a concurrent lecture co-requisite. documentation, management, and maintenance will be discussed. CISW 31 Secure Web Server Programming in PHP CISW 17 HTML, CSS, and JavaScript Programming 3 Units (Degree Applicable) 3 Units (Degree Applicable, CSU) Lecture: 54 Lecture: 54 Corequisite: CISW 31L Advisory: CISB 11 Advisory: (CISN 34 and CISN 34L) or (CISW 24 and CISW 24L) Plan, program, implement, publish, and maintain web sites using Plan, install, and manage secure Apache Web servers using server Hypertext Markup Language version 5 (HTML5), Cascading Style Sheets side programming language like PHP (PHP: Hypertext Preprocessor) to version 3 (CSS3), and JavaScript.
    [Show full text]
  • NIST SP 800-28 Version 2 Guidelines on Active Content and Mobile
    Special Publication 800-28 Version 2 (Draft) Guidelines on Active Content and Mobile Code Recommendations of the National Institute of Standards and Technology Wayne A. Jansen Theodore Winograd Karen Scarfone NIST Special Publication 800-28 Guidelines on Active Content and Mobile Version 2 Code (Draft) Recommendations of the National Institute of Standards and Technology Wayne A. Jansen Theodore Winograd Karen Scarfone C O M P U T E R S E C U R I T Y Computer Security Division Information Technology Laboratory National Institute of Standards and Technology Gaithersburg, MD 20899-8930 March 2008 U.S. Department of Commerce Carlos M. Gutierrez, Secretary National Institute of Standards and Technology James M. Turner, Acting Director GUIDELINES ON ACTIVE CONTENT AND MOBILE CODE Reports on Computer Systems Technology The Information Technology Laboratory (ITL) at the National Institute of Standards and Technology (NIST) promotes the U.S. economy and public welfare by providing technical leadership for the nation’s measurement and standards infrastructure. ITL develops tests, test methods, reference data, proof of concept implementations, and technical analysis to advance the development and productive use of information technology. ITL’s responsibilities include the development of technical, physical, administrative, and management standards and guidelines for the cost-effective security and privacy of sensitive unclassified information in Federal computer systems. This Special Publication 800-series reports on ITL’s research, guidance, and outreach efforts in computer security and its collaborative activities with industry, government, and academic organizations. National Institute of Standards and Technology Special Publication 800-28 Version 2 Natl. Inst. Stand. Technol. Spec. Publ.
    [Show full text]
  • Theme JEE and .Net OMA Implementations (Part 1)
    Application Servers Session 4 – Main Theme JEE and .Net OMA Implementations (Part 1) Dr. Jean-Claude Franchitti 1 Icons / Metaphors Information Common Realization Knowledge/Competency Pattern Governance Alignment Solution Approach 22 Web Application Servers Architectures (Evolution) Traditional client-server technology CGI frameworks Page-based extended HTML environments Distributed object computing platforms Java-Based Object Management Architectures (OMAs) Component-based computing environments Web Services platforms Next generation application servers (reflective, multimedia- and agent enabled, MDA-compliant, etc.) 3 Web Application Servers Architectures (Page-Based Extended HTML Environments Details) Application Servers for Enhanced HTML (traditional) a.k.a., Page-Based Application Servers Tag-Oriented (e.g., Macromedia ColdFusion 5.0 Server) Script Oriented (e.g., Microsoft IIS with ASP, PHP) Mostly Used to Support Standalone Web Applications Typically less expensive than standalone and IDE-based servers HTML-based development New Generation Page-Based Script-Oriented App. Servers First Generation Extensions (e.g., Microsoft IIS with COM+/ASP) Servlet/JSP Environments XSP Environment Can now be used as front-end to enterprise applications Hybrid development environments 4 Web Application Servers Architectures (Beyond Page-Based Extended HTML Environments Details) Distributed Object Computing Platforms Provide an infrastructure for distributed communications enabling Still need to merge traditional web-oriented
    [Show full text]
  • Surface Contents Author Index
    Surface Contents Author Index Mu-Lin WU, Chiou-Hsiung CHEN & Chih-Hsin CHEN DESIGN AND OPERATION OF SPATIAL DECISION SUPPORT SYSTEMS FOR WATER RESOURCE PROTECTION a b b Mu-Lin WU , Chiou-Hsiung CHEN , Chih-Hsin CHEN aCivil Engineering Dept., National Pingtung Univ. of Science and Technology, 39-13 TongZong Road, Dali, Taichung County, 41244, Taiwan [email protected] bTaipei Watershed Management Bureau, WRA, MOEA, 5, Lane 45, Sec. 1, Peihsin Road, Hsien-Ten, Taipei 231, Taiwan [email protected] Commission II, WG IC II /5 KEY WORDS: Spatial decision support systems, Water resource protection ABSTRACT: Spatial decision support systems for water resource protection at Taipei Watershed Management Bureau (TWMC) have been pursued for more than a decade. There are five townships and two watersheds under jurisdiction of TWMC. The whole area under management of water resource protection is 717 square kilometres. The management objective is to provide sustainable drinking water for a population about four millions in Taipei. Management prescriptions for water resource protection at TWMC are not confined to traditional approaches. Design of spatial decision support systems for water resource protection was mainly focused on integration of techniques such as remote sensing, geographic information systems (GIS), and global positioning systems (GPS). The major ingredients of spatial decision support systems are web-based GIS which can bring relevant information for management of water resource protection for a given location say, x and y coordinates, a single sheet of map, a township, even a watershed. All maps, satellite images, and orthophoto maps were stored in scalable vector graphics (SVG) format.
    [Show full text]
  • Best Practices for Securing E-Commerce Special Interest Group PCI Security Standards Council
    Standard: PCI Data Security Standard (PCI DSS) Date: April 2017 Authors: Best Practices for Securing E-commerce Special Interest Group PCI Security Standards Council Information Supplement: Best Practices for Securing E-commerce Information Supplement • Best Practices for Securing E-commerce • April 2017 Document Changes Date Document Version Description Pages January 2013 1.0 Initial release All January 2017 1.1 Expanded and revised Various content based upon the Securing e-Commerce Special Interest Group April 2017 1.2 Corrected entries in table, Various Section 2.7 typographical and grammatical errors The intent of this document is to provide supplemental information. Information provided here does ii not replace or supersede requirements in any PCI SSC Standard. Information Supplement • Best Practices for Securing E-commerce • April 2017 Table of Contents Document Changes ................................................................................................................................................. ii 1 Introduction ........................................................................................................................................................ 5 1.1 Background ................................................................................................................................................... 5 1.2 Intended Audience ........................................................................................................................................ 7 1.3 Terminology .................................................................................................................................................
    [Show full text]
  • Parametric Web-CAD for Box Culvert Design
    147 Parametric Web-CAD for Box Culvert Design Julian H. Kang1, Byeong-Cheol Lho2 and Sang-Rung Choi3 1Texas A&M University, [email protected] 2Sangji University, [email protected] 3Hanseok Engineering Co., Ltd., [email protected] ABSTRACT This paper presents a development of Web applications to improve the process of a box culvert design and document management using XML and SVG. The box culvert is one of the simple and common structures employed repetitively in road construction. Although parametric computer applications have demonstrated a significant amount of time savings in designing simple and repetitive structures, circulating resultant electronic documents among project participants has not been fully integrated with these applications. We developed a parametric Web application in order to facilitate not only engineering design of the box culvert but also management of resultant documents over the Web. This paper presents how XML Data Island and SVG were utilized to generate engineering drawings and display them in the Web page. Keywords: Design Automation, Web-CAD, XML, SVG projects. Web-based project management, which stores 1. INTRODUCTION information in the central repository, therefore has A box culvert is one of the common structures employed attracted many AEC firms because of its potential ability in road construction. Over the last decade, many box of building a project legacy database by collecting culverts have been constructed in Korea. The shape of electronic documents in the central repository. The these box culverts is fairly simple and typical no matter frequency and cost of the bridge repairs made a public where they were built.
    [Show full text]