Introduction


One sure sign of the significance of Active Server Pages is that it is often confused with Internet Information Server 3.0. That is, many people think that they are synonymous. In reality, ASP is a single ISAPI filter that has been added to IIS 3.0. In almost everyone's mind, however, ASP has evidently supplanted the Microsoft Web server.

The second sign of the significance of ASP is much more subtle, and far more profound. The purpose of this book is to bring this level of significance into the open. In a word, ASP is the key to understanding everything else Microsoft is doing.

For years, many people have assumed that Gates' famous phrase, "Information at Your Fingertips" was merely the sanitized propaganda of a Redmond software hegemony. In this interpretation, the "information" at your fingertips was a function of the Microsoft application you were using. The implication was that the more Microsoft products you used, the more information would be at your fingertips. This interpretation was reinforced by another (earlier) war cry, "A PC on every desktop, all running Microsoft programs."

With ASP, a new interpretation of Microsoft strategy is now possible. This interpretation is not grounded in speculation, but in direct experience. Each one of us can experience this new interpretation for ourselves when we first use an ASP application that uses ActiveX Data Objects (ADO), for ADO is based on a technology that is based on a premise that has far reaching implications for society. The technology is OLEDB, and the premise is "universal access, not universal storage."

What Microsoft means by this is that the key to "Information at Your Fingertips" is not realized by relying on local storage (and so, is not strictly a function of owning Microsoft programs). Fingertip information comes by going to the data, by knowing where it is and how to access it. In the same way that the Open Database Connectivity (ODBC) initiative enables SQL databases to communicate seamlessly with each other, OLEDB promises the same for data stored in all formats and on all servers attached to the Internet.

If you ponder the true nature and purpose of the Internet, HTML, and open standards, you begin to see that they are the public infrastructure counterpart to the private initiative that can only be adequately collected under the rubric of Active Server Pages. That is, only ASP gathers everything Microsoft needs-ActiveX controls, database access, the Component Object Model, the Distributed Component Object Model, and the Internet Information Server 3.0-into one coherent system. That public infrastructure and that private initiative are inseparable. What ASP does is make things easier for you-the developer- by bringing everything together under one umbrella or as you say into one coherent system.

The key is to recognize the coherence of this strategy. Few strategies have held together so well intrinsically and extrinsically, privately and publicly: IIS 3.0, without ASP, is just another Web server; with it, Microsoft has the last puzzle piece in place. In the same way, tightly integrating ADO into ASP conjoins everything else. Either one without the other is much less than half of both. ADO can be used in all Microsoft programming languages, but then it's restricted to the local file system. ASP without ADO, on the other hand, is no more than HTML. ASP without the Internet is doomed to isolation on the world's intranets. With the Internet and Active Server Pages, "Information at Your Fingertips" becomes a global reality and not one reserved only for the Microsoft faithful.

Whether this serves humanity or not is not up to Microsoft, it's up to us.

Transforming Internet/Intranet-Based Application Development

In his book, The Road Ahead, Bill Gates likens the Information Superhighway to the building of the national highway system in the United States, where the Internet represents the starting point in the construction of a new order of networked communication. We share his vision of the importance of this evolving communications infrastructure. And with this beginning, like the auto industry that blossomed with the expansion of well-developed roads, the production of software applications to leverage this new network infrastructure will be the blossoming industry as we move into the twenty-first century.

Before the marketing manager, CEO, or general consumer can appreciate the transformational value of this new superhighway, software applications that make the transition beyond the simple display of hypertext documents must become widely available. The development of these software applications will determine the long-term success or failure of this rapidly evolving set of global networks.

This superhighway, with its widely adopted standards and explosively expanding network connectivity, has launched a new era for software developers. Application developers working in groups, ranging from commercial software companies to corporate MIS teams, are discovering the capability to rapidly implement applications that extend and surpass even the most progressive groupware and client/server implementations currently in place.

Amidst this incredible excitement, however, developers building these applications quickly come to understand the immaturity of the development tools currently available. Until recently, most Internet developers found themselves working in first generation programming languages with the development environment consisting of little more than a text editor. This has been the primary drawback for developers, especially ones that have become spoiled in mature, graphical development environments. At this point, we hope to amaze and delight you with the power and ease of Web-based programming with Active Server Pages.

A New Era in Application Development

Active Server Pages represents a fundamental transition point for developers. If the Internet ushered in a new era in communication and network connectivity, Active Server Pages represents the first step in the beginning of an application development revolution. Unlike the client-specific processing associated with client side VBScript and ActiveX (OCX), Active Server Pages processes at the Server and opens the door to using other server services and function libraries in your application development process. Active Server Pages provides the building blocks that Microsoft has used in the creation of portions of its Commercial Internet System, and this environment already has become the foundation for its rapidly evolving platform of Internet development tools. Active Server Pages provides the key to leveraging the rapidly evolving standards as well as the existing ones including:

Active Server Pages bring the widely used Visual Basic programming environment to developers as the glue to integrate both new and existing server applications and services. By providing a means to build applications, utilizing the evolving OLE technologies, Active Server Pages bridge the gap between current Internet development and more traditional client/server development.

This book explores all of the key building blocks to deliver a Web-based application with Active Server Pages. From an appendix offering a quick tour of HTML to an introduction to COM and DCOM objects. This book offers an implementation-oriented guide to Internet/intranet development, exploring the key technologies including:

By taking a hands-on look at all of the pieces of the Web- based application puzzle and then tying them together in a case study application, located in the Appendices, this book provides a complete guide to creating either your first or your best Web-based application. By organizing the sections and chapters of this book into stand-alone modules, this book provides a working tool for both beginning programmers and advanced developers making the transition into the best of the evolving Web-based application development environments.

Who Should Read This Book

The core of this book focuses on developing Active Server Pages- based applications. Although we address networking and business issues, we give primary attention to the programmer responsible for design, development and/or implementation of an application, including the database connectivity and user interface requirements. Within the programming community, we have paid special attention to programmers with four core backgrounds:

For the Microsoft Programmer

If you have a background in application development based on any of Microsoft's BASIC languages, you will find Active Server Pages to be a painless transition to the Web development world. The writing team came from backgrounds in Visual Basic, C++ and Access Basic, and at first glance we saw Web programming as some black box. How does the Web browser talk to the Web server, and how does the Web server invoke our programs? And in the beginning, trying to understand the mechanics of the Common Gateway Interface (CGI) was very confusing. Fortunately, those days have left us, and the Active Server Pages development tools have made the process much easier to understand and work with.

Almost all of the application development techniques and constructs you've used in Visual Basic will partially or completely port to the Web world. In fact, as you will see demonstrated, the Visual Basic code you might have written to open a recordset from an ODBC datasource can in some cases be plugged directly into an Active Server Page. Although you need to take some time to understand the differences between VBScript and the full Visual Basic environment, you can actually use any version of Visual Basic to write VBScript code.

Without making it sound too simple, you will need to spend a little time to understand the client/server programming model of the Web. But with the lessons delivered in this book, you will rapidly be able to prototype applications within this environment. In fact, we even have a section to help you make sure your NT Server with the Internet Information Web Server is set up correctly. And to complete your Web programming jump- start-aside from the actual development of code-we hope to provide you with a good working knowledge of other Web-specific issues, ranging from security to network monitoring.

For the Web Developer

If you have written your own CGI programs in PERL, or if you have only used HTML in the past, this book provides you a key reference to leverage the power delivered in Microsoft's evolving generation of the Web-based application development tools. If you have working experience in HTML, you will quickly be able to integrate Visual Basic code into HTML pages for server-side processing. This technology provides a server-side, not client- side, approach to application development, which like CGI, enables you to deliver browser-independent applications. You can still invoke CGI applications from Active Server Pages, but you will quickly appreciate the reduced need to rely on CGI programs and will also begin to leverage the newly evolving market for COM objects, which offer a more efficient and flexible approach to accomplishing the same tasks.

The CGI programmer already has the knowledge and skills to build Internet applications, but you will be amazed by the efficiency and added value that Active Server Pages brings to the table. Although you will have to learn some Visual Basic, your core skills will translate rapidly into this environment. Windows NT and its interoperability between applications will quickly excite you with the possibilities inherent in Active Server Pages development..

For the Programmer New to Microsoft and the Web

If you have a programming background but have never worked directly with Visual Basic or TCP/IP-based network protocols such as HTTP, you have probably felt a little overwhelmed with the challenge of getting started. Maybe you have played with HTML and have been surprised by how quickly you have learned it, or maybe you have yet to even try it. Don't despair; with Active Server Pages and, as a direct result VBScript, the programming languages have finally evolved to a point where any person with a programming background can quickly get started.

Not to oversimplify: You have some work to do. You need to build a working understanding of HTML, a good knowledge of Visual Basic, and preferably some overview feel for the client/server model of the Web browser and the Web server. All of this and more will be delivered in the pages of this book.

This book provides a hands-on approach to making the transition to Web-based application development. Although this book provides some help in getting your Web server set up, if you have not set up a Web server before you may want to consider working with an Internet Service Provider (ISP) who supports Active Server Pages.

ON THE WEB

For more information finding Internet Consultants and Web Presence Providers, see

http://www.yahoo.com/Business_and_Economy/Companies/Internet_Services/

How This Book Is Organized

In our effort to address the different needs and skill levels of programmers, we have organized this book in two primary ways. First, by providing a case study-based theme with comprehensive Web site backup material, this book can act as a complete jump-start for a programmer trying to get up to speed in Web-based development. Second, within the case study theme, each section and chapter has been designed as a module-based guide, organized to provide readers with the capability to drill into one topic as a stand-alone guide in one particular aspect of the set of technologies discussed.

Specific parts of this book sequentially address the skills necessary to build a Web-based application:

The module based nature of the book allows you to drill specifically into what you need to know. Whether you want a quick study on conditional processing or a look at how to validate credit cards over the net, you can drill into the implementation oriented book, to leverage Active Server Pages.

As the last, and perhaps most valuable resource provided by this book, we have provided an evolving Web site, http://www.quecorp.com/asp, which contains the source code, documents, and additional reference material that you might normally find on a CD. Rather than lock in the additional materials provided with this book on a CD, we have chosen to focus entirely on a Web site to provide resources in this rapidly evolving development area. In addition to the source code and other reference documentation provided, the Web site will identify additional resources available on the Internet, related to Active Server Pages.

A Final Note

As we built Web-based applications for bussinesses, we have often reflected that the continuing improvement of development tools and porting of more mature development languages to the Web envrionment continue to make application development easier and easier.

Most people stop at before they get started because at first glance developing Web-based applications seems like such a fundamentally different environment. However, as we have trained programmers to implement Web-based applications based on leveraging HTML and CGI tools, we continually felt that a time would come when these technologies would become easily accessible to the general programming community. Well, that time is now, and the development tool that will bring the development community onto the web is Active Server Pages.

We have waited with great excitement for the standards and tools to evolve to the point where commercial software vendors and general service providers would begin to rapidly provide Web software. And so it is with great excitement and pride that we offer this book to you in the hope that it will be a valuable guide in your efforts to becoming an active contributor in the emerging Inter/intranet application revolution.

Conventions Used in This Book

Que has over a decade of experience developing and publishing the most successful computer books available. With that experience, we've learned what special features help readers the most. Look for these special features throughout the book to enhance your learning experience.

Several type and font conventions are used in this book to help making reading it easier:

[Tip]

Tips present short advice on a quick or often overlooked procedure. These include shortcuts that can save you time.

[Note]

Notes provide additional information that may help you avoid problems, or offer advice that relates to the topic.

[Caution]

Cautions warn you about potential problems that a procedure may cause, unexpected results, and mistakes to avoid.

[Cross Reference]

See these cross-references for more information on a particular topic.

[Sidebar]

Sidebar

Longer discussions not integral to the flow of the chapter are set aside as sidebars. Look for these sidebars to find out even more information.


© 1997, QUE Corporation, an imprint of Macmillan Publishing USA, a Simon and Schuster Company.