ebook img

Wiley - Developing Web Applications with VB.NET and ASP.NET PDF

298 Pages·2002·5.26 MB·English
by  
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Wiley - Developing Web Applications with VB.NET and ASP.NET

Developing Web Applications with Visual Basic .NET and ASP.NET John Alexander Billy Hollis Wiley Computer Publishing John Wiley & Sons, Inc. Publisher: Robert Ipsen Editor: Theresa Hudson Developmental Editor: Kathryn A. Malm Managing Editor: Angela Smith New Media Editor: Brian Snapp Text Design & Composition: John Wiley Composition Services Designations used by companies to distinguish their products are often claimed as trademarks. In all instances where John Wiley & Sons, Inc., is aware of a claim, the product names appear in initial capital or ALL CAPITAL LETTERS. Readers, however, should contact the appropriate companies for more complete information regarding trademarks and registration. This book is printed on acid-free paper. Copyright © 2002 by John Alexander and Billy Hollis. All rights reserved. Published by John Wiley & Sons, Inc., New York Published simultaneously in Canada. No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4744. Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 605 Third Avenue, New York, NY 10158-0012, (212) 850-6011, fax (212) 850-6008, E-Mail: <[email protected]>. This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold with the understanding that the publisher is not engaged in professional services. If professional advice or other expert assistance is required, the services of a competent professional person should be sought. Library of Congress Cataloging-in-Publication Data: ISBN: 0-471-08517-0 Printed in the United States of America. 10 9 8 7 6 5 4 3 2 1 To all our loved ones, those whom we hold so dear, and to those departed whom we miss. This is for you. Life is a measured gift, use it wisely and make it count. About the Authors John Alexander is the Marketing Technologist for G.A. Sullivan. His broad project experience includes building solutions in several industries on platforms ranging from the mainframe to the Internet. A Microsoft Certified Solution Developer and Trainer with 19 certifications, John has also written Microsoft Official Curriculum (some of the earliest on Active Server Pages) and consults and teaches at sites from Seattle to Moscow. Highly experienced in software estimation, requirements gathering and definition, creating project plans, defining deliverables, and working on all phases of the software development life cycle, John prides himself on achieving solutions that exceed the client's expectations. A featured speaker at conferences such as VB Connections, Web Tech-Ed 98, Developer Days, and VBITS, John has been nominated and chosen by Microsoft for the fourth straight year as a Microsoft Developer Network Regional Director. He is currently serving on the Microsoft virtual .NET Subject Matter Expert Team for DevDays 2001, has consulted as a technical adviser on .NET e-Business Architecture by G.A. Sullivan, published by SAMS, and has recently finished a speaking tour on .NET technologies. He is currently advising a major client on their first .NET project. G. A. Sullivan is a global e-Business solution company. Since 1982, G. A. Sullivan professionals have consistently delivered complex enterprise solutions and provided strategic consulting to specific vertical industries. The company's focus is to drive maximum business results from technology investments. G. A. Sullivan is a leader in implementing technology and providing business value using Microsoft's .NET platform. As one of Microsoft's leading development partners worldwide, G. A. Sullivan has proven experience as documented in numerous case studies. G. A. Sullivan's expertise is validated in their most recent technical book titled .NET e-Business Architecture, which documents best practices learned building an enterprise-class application utilizing the Microsoft .NET platform. Details are available at www.gasTIX.net. G. A. Sullivan was among the first companies in the world to become a Microsoft Gold Certified Partner for E-Commerce Solutions. With 300 professionals across six U.S. and two European locations, G. A. Sullivan consistently ranks as one of the fastest growing technology companies in the United States. Learn more about G. A. Sullivan by visiting www.gasullivan.com. Billy Hollis has been developing software for over twenty years. He has written for many technical publications, and is a frequent speaker at conferences, including Comdex, Microsoft's Professional Developers Conference (PDC), and the Visual Basic Insiders Technical Summit (VBITS). Billy is co-author of the first book ever published on Visual Basic .NET, VB.NET Programming on the Public Beta, and sole author of the book Visual Basic 6:Design, Specification, and Objects. Billy is MSDN Regional Director of Developer Relations in Nashville, Tennessee for Microsoft, and was named Regional Director of the year for 2001. He is currently heavily involved in training, consultation, and software development on the Microsoft.NET platform Cole Francis is a Senior Consultant for G.A. Sullivan in Kansas City, MO. He plays many roles as a consultant, including Business Analyst, Software Developer, and Quality Assurance. Cole is a Microsoft MCP, delivers occasional presentations for G.A. Sullivan, and has recently taken part in a Microsoft Case Study. Cole would like to thank his wife, Tami, and his daughter, Kyrstin, for their ongoing dedication and support. Cole would also like to thank John Alexander for the opportunity to be a part of this book. Brian Wendt is a consultant in Nashville, Tennessee. He has been working in the IT industry since 1983, previously in UNIX environments, and has spent the last ten years working with Microsoft technologies. He holds several Microsoft certifications including MCSD, MCDBA, and MCSE+Internet. In addition to .NET, his skills include C, C++, Microsoft SQL Server, ASP, Visual Basic, and JavaScript. Acknowledgments From John: John would like to thank Valerie, Nathaniel, and Ian for sticking by him through the making of this book. Daddy promises not to lock himself in the basement any more. Thanks to the contributors on the book: Cole Francis and Brian Wendt for the absolutely rocking job you guys did on this. Thanks to Donis Marshall for the advice, guidance, assistance, and persistence throughout this process. Thanks to the following folks at G.A. Sullivan: Greg Sullivan, Dave Smith, Don Benage, David Burgett, Matthew Baute, and Eric Brown. Dedication to quality is often given lip service, in the consulting industry but rarely followed through. I'm proud to be a part of this organization! John also thanks the following folks at Microsoft that gave assistance, both directly and indirectly: Jennifer Ritzinger, David Lazar, Ari Bixhorn, Susan Warren, Dave Mendlen, Mike Iem, Scott Guthrie, Ilya Bukshteyn, Keith Ballinger, Chris Featherstone, and last but not least Steve Loethen. And of course John would like to thank the Wiley Publishing crew that made this into what is now: Kathryn Malm, developmental editor extraordinaire, Terri Hudson, Ben Ryan, Jen Bergman, and his publisher, Robert Ipsen. And finally thanks to Mom and Dad for the Commodore Vic-20 that started it all.... From Billy: Thanks, as usual, to my family for being forgiving enough to allow me the time to write another book. Cindy, Ansel, and Dyson have all been wonderful throughout my writing career. I'd also like to offer appreciation to the folks at Microsoft that have given me invaluable assistance in the past few months, including, but not limited to, Mike Iem, Ari Bixhorn, and Jennifer Ritzinger. They exemplify the spirit of their company. Introduction Developing Web Applications with Visual Basic .NET and ASP.NET was born out of a desire to enable experienced Visual Basic developers to extend their knowledge and experience investment to the Web easily and seamlessly. The thought behind this title is that the developer wouldn't need to master several technologies for ASP.NET development but could use the integrated tools and practical techniques to be productive quickly. It's also designed to be a code-based, hands-on introduction that will prepare, you, the reader for more focused titles. Who Should Read This Book If you are a Visual Basic programmer who has significant experience with: • Event-driven programming (including working with forms and controls) • COM component development • Data access using ADO • Basic familiarity with HTML, but little exposure to Web-related development concepts then you should read this book. This book will help you to extend your existing knowledge investment to building Microsoft technology-centric Web Applications in .NET. For the VB Developer, learning ASP Web development meant dealing with a variant of VB, a blurred line between code and content, component deployment issues, and bulky, interpreted solutions that are sometimes less-than-elegant. In addition, the paradigm shift required for Web development meant rethinking traditional application design and architecture methods as well. ASP.NET is an exciting new platform for developing, deploying, and running Web applications. It is a major enhancement of ASP; solving performance, scalability, and deployment challenges while strengthening the platform through its extensive compiled programming language support and a simplified, more powerful page model. The integration of Web development features in Visual Basic .NET through its support of ASP.NET allows VB developers to make the transition more easily than ever before, without the use of separate tools or technologies. A major ASP.NET design goal was to create a similar programming model so that VB developers would have a shorter learning curve in building Web applications, thus solving many of the aforementioned problems using earlier technologies. This frees the developer to focus on the new concepts introduced by Web development without the need to learn multiple environments and tools in the process. How This Book Is Organized Chapter 1 provides a basis for introducing the vision of the Next Generation Web: Microsoft .NET! The developer is introduced to the .NET common language runtime and extensive language support. Next, Microsoft .NET Enterprise Servers (such as Commerce Server and BizTalk Server) are briefly discussed before descending to highlight the native underlying Internet related services exposed by Windows 2000. This discussion culminates in Chapter 1 with an overview of the programming enhancements and fundamental changes to Web development that ASP.NET provides. The point of this chapter is to start a foundation that will set the overall tone for the remainder of the book. Chapter 2 begins with issues and concepts surrounding the impressive changes that especially impact ASP.NET development. Expanding the background in the previous chapter, now we start to explore the new features of the next version of Visual Basic. As the new environment features are highlighted, the reader will understand that the Visual Basic's RAD virtues have been extended for Web development. Building on the changes introduced in Chapter 2, Chapter 3 continues with those changes in Visual Basic that pertain to Object-oriented development. The focus of Chapter 4 is to acquaint the Visual Basic developer with DHTML for use in building ASP.NET Applications. Attention is given to illustrate the improvements brought about by the new server-side controls and the expanded flexibility that developers gain. Important for all levels of browser support, the ability of the server-side controls to automatically generate "uplevel" and "downlevel" HTML intelligently is shown as well. Chapter 5 gives an overview of ASP.NET Pages, building on the knowledge of the previous preparatory chapters. As ASP.NET support is completely integrated into Visual Basic.NET, VB developers are able to effectively use their experience in making the transition to web development. Developers will also discover the ease of UI development through the use of WebForms, the use of the Code-behind method of writing ASP.NET Page code, and the simplified page object model. VB developers who have experience with WebClasses will appreciate the expanded capability and functionality of WebForms illustrated through several examples. One of the exciting new features of ASP.NET is the ability to utilize and customize server- side controls. As control usage is natural to every VB developer, this knowledge will be extended to ASP.NET. Building on the discussion in Chapter 4 with HTMLControls, the focus in Chapter 6 now shifts to the WebControls, illustrating usage and function through practical examples. Since many of the WebControls will be familiar to the VB Developer from the start, the emphasis is on essential usage scenarios such as page navigation, validation, data access, and client-event handling topics. In addition, we've added a brief section on creating custom controls. Chapter 7 deals with the second member of the ASP.NET platform: Web Services. Web Services can be used to enable remote access to internal systems from the Internet, thereby supporting integration and business-to-business applications. Developers will learn that Web Services are server objects that use the Simple Object Access Protocol (SOAP) (or HTTP- Get/Post) to accept requests and return results. They also discover that clients using the Service Description Language (SDL) discover these objects. The next topic is XML (the basis for SOAP and SDL) and its importance to Web Services as the common language of communication. The key concepts of these infrastructure technologies are touched upon before moving into a practical discussion of creating and testing a Web Service. Chapter 8 begins with an overview of ADO.NET, the powerful yet simple-to-use data access toolset that is instrumental for creating rich Web applications. More than just a simple enhancement of Active Data Objects, ADO.NET brings true platform interoperability and scalable data access through the use of XML as the format for data transmission. The developer is reintroduced to the concept of data binding-from the server. The XML Designer and the ADO.NET Data Set Designer are examined in detail, with practical examples to illustrate usage. Special emphasis is placed on the fact that any COM+ object can be bound, in addition to traditional data stores. Formatting and error handling topics are also addressed in order to have a well-rounded understanding of this important subject. ASP.NET simplifies configuration and deployment by improving the deployment process for both code and ASP.NET pages, and by providing extensible application configuration. Chapter 9 covers the differences between Application-level and Session-level scope. Next, proper usage and expanded support of the Application and Session objects are highlighted. Various scalability issues surrounding application design and maintenance are woven in throughout this section to underscore their importance, including data caching. As Security issues are on the mind of every developer, a primer on the ASP.NET Authentication/Authorization Services is of great importance. The chapter concludes with techniques for programmatically authorizing the user once authenticated. Chapter 10 rounds out the title by providing a walkthough of a sample enterprise prototype application. Starting with design documents, we first discuss the requirements for the application and then move into an explanation of selected code listings. In addition, the data store and stored procedures are examined and explained, as is the presentation tier. A Web service for the client is also discussed. Let's check out some background material on .NET and why it's important before moving on to Chapter 1. .NET-Background and Purpose .NET was introduced to the public in July 2000 at Microsoft's Professional Developers Conference. This technology had been in development for more than two years, under very heavy wraps. We had seen various aspects of what was to become .NET (at that time called "Next Generation Windows Services") at different times in the preceding year. The pieces, however, didn't reveal the overall plan. As we'll see in the following chapters, .NET makes our job as developers quite a bit easier for a multitude of tasks. Microsoft .NET represents a revolution in application development-not just for Web application development, but for Windows apps as well. Moving information from anywhere to anywhere is the basic message of .NET. This means that that information should be able to flow from a mainframe to a phone or wireless device and anything in between. The key to making this information flow possible is Microsoft .NET's heavy reliance on standards-based protocols and formats, such as XML and SOAP. Another key factor is that .NET has been specifically designed with the Internet in mind. To make the .NET vision a reality, companies must make many changes not just in technology, but also in philosophy. It can be a challenge for corporations to fully grasp the .NET vision, despite the many attempts to explain and demonstrate the different scenarios in which .NET is useful. The best usage scenario I've seen in front of the public currently is in a TV commercial featuring lettuce. The scene begins with a shot of rotting lettuce sitting on a warehouse dock in the hot summer sun. The CIO (coincidentally visiting) confronts the warehouse foreman about the situation. The foreman explained that the delivery information was incorrect, that the distributor had been faxed, and they were waiting on a confirmation. The CIO then harangues the foreman about the fact that the company has computers that could solve this problem. The foreman replies, "Too bad they can't talk to my distributor." The commercial ends with a warehouse worker using a wireless device to reroute the lettuce on the fly, solving the problem and saving the lettuce. In 30 seconds, seamless communication between the partners in the business transaction is beautifully illustrated. Before we can leap into the future, however, we need to understand where we've been. We're making the assumption that you've already read about the evolution of the database application from desktop to client/server to distributed. Let's take a quick look at the evolution of Web applications and learn why it's been such a long road. Until relatively recently the development environment, testing tools, and interoperability elements were comparatively primitive in light of what you've been used to as a Visual Basic developer. Three Generations of Web Applications The first generation of the Web application were Web pages and early dynamic systems that focused on exposing large amounts of static information through standard formats and protocols. Because the graphical nature of HTML was simple to understand and use, most anyone could publish a Web page. Vast numbers of users were empowered with the ability to publish and consume information on a wide scale. However, as the demands for up-to-date content increased the challenges of providing this competitive edge with little more available than manual tools mounted. Single or limited user resources were limiting the refreshing of content on a timely basis. The use of client/server architecture began the rise of the shared resource, elevating departmental-level computing. However, this architecture relied on a fixed number of resource connections, so scalability was limited. Client/server applications were amplified with Web browsers and server applications. The industry focused on rich OS and local services afforded by products like SQL Server, Exchange, and SNA Server. Web app developers took advantage of these local services and used HTML to "project" the UI to many types of clients. While this allowed for an explosion of information that was freely accessible, the static nature paved the way for the next generation. The absence of business efficiency meant that the main focus was on simply having an Internet presence ("brochure-ware because we gotta be there!"). The main metric of this time was the number of hits that the site received. The focus still wasn't on scalability; resources and connections were still directly tied together. In 1996, Microsoft introduced a technology code-named "Denali" that changed Internet application development forever. The technology, of course, was Active Server Pages (ASP), and moved developers one step closer to Rapid Application Development for the Web. It was a huge kludge, and awkward and cumbersome, but, man, it was cool! Although there had been server-side technologies before ASP, none gave developers as much control and flexibility as the new offering. Thus, the second generation was born, ushering in Windows DNA. Applications moved towards the n-tier architecture or distributed model. By freeing resource connections from direct communication with the business and presentation layer (the client), applications were able to provide greater scalability and performance while accessing enterprise data. In addition, the widespread use of a combination of "stateless" Web protocols with DNS and IP routing enabled scalability at quantum levels while improving the manageability and reliability of the applications themselves. While this was all well and good, debugging these applications was a pain in the registry, to put it mildly. With the separation of data and business logic, the applications themselves were improving, but the developer tools that spanned the different tiers and technologies were still in the dark ages. Developers also had to stay current on a plethora of different technologies to support and maintain these applications. The need for interoperability between local and remote systems ushered in the modern age of Web applications. This new generation requires a standards-based mechanism to transmit data. And, as many have now learned, a business reason as well. Many Web sites and applications sprung up (literally overnight in some cases) without a clue or care on how to make a profit, made a ton of money in an IPO, and then spectacularly exploded when the .COM bubble burst. Applications become programmable Web Services, similar to those little plastic building blocks you may have used (or stepped on in the middle of the night) long ago. Web services permit applications to communicate, regardless of operating system or programming language, using the Internet as the medium. They are the "secret sauce" that finally will allow open communication between business entities, both internally and externally. The key is that Web Services use protocols that are defined through public standards organizations such as the W3C. They enable not just the sharing of data, but can also invoke

Description:
NET development but could use the integrated tools and practical techniques to be . having an Internet presence ("brochure-ware because we gotta be there!"). The main .. data from the database engine. The FOR .. phones, handhelds, tablet PCs, and game consoles (as well as the XBOX). Taking
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.