Web Programming with ASP and COM with CD-ROM
Authors: Matt J. Crouch
Venue:  (1999)

From the Book:It was bound to happen sooner or later. We've come to take for granted the Internet and all it has to offer. We can research, shop, entertain ourselves, and communicate with others worldwide without leaving our PC. Your average Web surfer does not give any second thoughts to the magic behind the scenes of these Web sites that enable us to carry out these activities, but you are a Web application developer who provides these experiences for the Web-surfing masses. For many businesses, a Web site is not just an attractive marketing tool, but a mission-critical piece of their revenue stream. Your job is to ensure the best possible user experience for the Web surfer, and, unfortunately, the time-to-market for these important Web applications shrinks with each passing day. So, how are you, the software developer, planning to cope with this trend? Fortunately for you, Web application development has taken turns for the better in recent years. Many new tools have become available that make life easier when programming interactive Web applications. A wonderful technology from Microsoft called Active Server Pages shines in this capacity. By using simple scripting languages, coupled with its ability to call on the services of reusable code objects, applications come together with ease. Active Server Pages hides the required low-level details of interactive communications with Web servers, and COM components allow us to take advantage of prepackaged application functionality. Together, Active Server Pages and COM deliver on the promise of rapid application development for the Web. Is This Book for You? By now, you may have noticed that I have referred to you, the reader, as a software developer. This book is geared for those software developers who need to deliver first-rate Web applications as quickly as possible. I certainly don't expect you to be an expert in Web application development. In fact, I assume that you have little or no knowledge of how Web applications work. However, I am forced to set a few prerequisites. Since we are working with Web pages, a working knowledge of basic HTML would be very helpful, which means you should be familiar with the common HTML tags as well as forms. You should also be familiar with URLs. And, it's a good idea to be familiar with the Windows operating system fundamentals, such as file operations (moving, copying, etc.) and navigation. We will be constructing COM components that will be built using Microsoft Visual C++. If you have worked with the C++ language for some time and you feel that you have a good understanding of it, then you are ready to tackle the chapters dealing with COM component construction. If not, you should brush up on your C++ skills by supplementing this text with a good C++ manual. The two primary subject areas of this text vary from moderately easy to somewhat difficult. The most difficult areas deal specifically with the COM architecture and its relationship to C++. Many C++ programmers have varying levels of skill, so, throughout the book, I will thoroughly explain concepts that may be unfamiliar to developers who have limited knowledge in programming using C++ in the Windows environment. This is key since the goal of this book is to bring the subject of ASP and COM to a broader audience, not just to those who develop in C++ exclusively for the Windows platform. In addition, exposure to relational database management system fundamentals would be beneficial in the chapters dealing with the "database-enabling" of your Web application. If you are comfortable working with tables, records, and key constraints and have basic database administration skills, you should be ready for the database sections in the book. Note: Here are some books that are recommended for bringing you up to speed on the prerequisites to the material in this book: HTML 3: Electronic Publishing on the World Wide Web by Raggett, Lam, and Alexander, Addison-Wesley, 1996. The C++ Programming Language, Third Edition by Stroustrup, Addison-Wesley, 1997. Fundamentals of Database Systems, Third Edition by Elmasri and Navathe, Addison-Wesley, 1999. Focus and Goal of This Book Why is the focus of this book on Active Server Pages and COM components? This book grew out of my own frustrations of trying to find a book that emphasized the importance of these technologies coupled together and how to best implement applications using them. I was also trying to locate a book that addressed the issue of writing efficient ASP applications, and I failed at that as well. My struggles to learn how to construct COM components with Visual C++ were worsened by finding only books that focused mostly on theory and that lacked the code examples I needed to start creating my own COM components quickly. This book will fill in the gaps that were left by others. Above all, my ultimate goal is to provide you with a flying start toward developing world-class Web applications easily and quickly. Active Server Pages and COM provide the best framework for this. Web application development, which was once possible only by using UNIX-based systems and CGI programs (more on CGI later), is now within the reach of friendly Windows-based servers. With easy-to-understand scripting languages and reusable code modules, developing Web applications becomes as easy as developing other types of programs. Software and Hardware Tools Used in This Book To develop ASP applications, you will need a 486 or Pentium-class PC. You will need a minimum of 16MB of RAM, although I advise you to upgrade to at least 32MB. You will find that all the development tools required will use quite a bit of memory. If in doubt, it will not hurt to add more RAM or hard-drive space to your computer! Ideally, your computer should have Windows NT Server 4.0 installed. NT Server 4.0 is required to install the latest version of Internet Information Server, version 4.0 (IIS version 5.0 is in beta). This configuration will allow you to take advantage of all the material we are going to cover in this book. I realize that having NT Server 4.0 installed on your computer may not be an option for you. Upgrading your PC with a new operating system, just to follow along with the exercises, may not seem worth it (although this author certainly hopes you think it's worth the trouble!). Windows NT Server 4.0 also carries a heavy price tag, which puts it out of the reach of many home-based PC users or hobbyist programmers. Also, if you have an older PC, its hardware may not be compatible with or powerful enough to run Windows NT. You will need Microsoft's Web server software, Internet Information Server (IIS). This requires Windows NT Server 4.0. However, if NT Server 4.0 is not possible for you to obtain, Microsoft has a solution for users with low-end hardware. Personal Web Server (PWS) 4.0 can run on Windows 9x and Windows NT Workstation. It provides all the features of Internet Information Server, but it is intended for low-volume Web sites and for development. PWS also cannot use many of the integrated security features of IIS, which makes it unsuitable when site security is an issue. Interactive debugging of Active Server Pages is also not possible with PWS. All that considered, it is to your advantage that you use Windows NT Server for your development. You may download IIS/PWS, which is part of the Windows NT 4.0 Option Pack (for both Windows 9x and NT), from Microsoft's NT Server Web site. This book also focuses on COM object development. The component development chapters of this book require Microsoft Visual C++ 5.0 or greater. In this book, examples will be shown using Visual C++ 6.0. If possible, it would be to your advantage to get v6.0 since it incorporates many time-saving features that make development easier. You may run Visual C++ on either Windows NT or Windows 9x. Depending on the installation, Visual C++ can use several hundred megabytes of disk space, so be selective when installing this software to ensure that you have room for all the other component pieces of the Active Server Platform. Optional Software There are some optional software packages that you may find useful to have around while you develop ASP applications. Microsoft Visual Studio includes Visual InterDev 6.0, which features a code editor specifically designed for editing Active Server Pages. Using sophisticated IntelliSense technology, the Visual Studio editor aids the programmer in coding by providing syntax highlighting and automatic statement completion. It is highly recommended, not just for ASP development, but also when building COM components in Visual C++. You can also use any full-featured text editor if you so desire. Let your conscience be your guide. We will be interacting with relational database management systems (RDBMSs) throughout the book. While a complete RDBMS package is not required, it will be helpful since the utilities provided in the RDBMS package will give you quick control over the administrative functions of the database. The examples in this book will use Microsoft Access databases. IIS and PWS will install all of the necessary database software required to talk to Microsoft Access databases. Installing the complete Microsoft Access package will enable you to quickly query data, administer the database, enter new data, run reports, and more. In later chapters, we will discuss how to migrate this data over to Microsoft SQL Server 7.0. Obviously, if you will be doing any of the exercises in that chapter, you will be required to install SQL Server. If you want to use some of the COM components that you create in other development environments, you can install those as well. As mentioned, COM components can be reused in many development environments. Visual Basic, Microsoft Office, and others are possible hosts for your COM components. Special Text Notations Key code lines are referenced in the text with a special symbol. Code lines that wrap are indicated with a soft return mark. Other Resources For your convenience, the enclosed CD-ROM contains all of the code used for our complete Web application, the Megabyte's Pizzeria. It also includes the other code samples scattered throughout the text. You will find installation instructions in Appendix A. Feedback I am always trying to improve the quality of this book. So, please send me your comments, suggestions, rants, raves, and so on. I can be reached at matt_ crouch@hotmail.com. I look forward to hearing from you! The ACM Portal is published by the Association for Computing Machinery. Copyright © 2010 ACM, Inc. Terms of Usage Privacy Policy Code of Ethics Contact Us Useful downloads: Adobe Acrobat QuickTime Windows Media Player Real Player