The Microsoft .NET Framework and Active Server Pages.NET (ASP.NET) allow developers to create world-class Web applications and Web services quickly and easily. Web applications built within the .NET Framework can integrate with any operating system running on any device. Web services are reusable component applications that enable distributed computing on the Internet, using standard protocols like HTTP and XML. Developers conversant in .NET can now deliver more dynamic applications to market more quickly.
ASP.NET and VB.NET Web Programming provides developers with the practical information and step-by-step guidance they need to become productive with .NET. This tutorial offers a comprehensive yet approachable introduction to the .NET Framework, ASP.NET programming, and XML Web Services development. Each chapter begins with an overview and then walks readers through one or more lab exercises that are well illustrated with screenshots and punctuated with tips and warnings. All examples are in Visual Basic.NET (VB.NET).
Key topics covered include:
Click below for Sample Chapter(s) related to this title:
Sample Chapter 5
1. The .NET Platform and the Web.
The Pathway to Web Applications.
The Web Client/Server Model.
Web Clients and Web Servers.
Protocols for Web Client/Server Communication.
Server-Side Processing with CGI Programs.
Disadvantages of Using CGI.
Components of ASP.NET and the .NET Framework.
Overview of Internet Information Server.
Overview of ASP.NET.
The .NET Common Language Runtime and Class Library.
Managed Components in .NET.
Language Independence in the .NET Framework.
COM+ Component Services and .NET.
Direction and Plans for .NET.
What Is VB.NET?
Hello World (Yet Again).
Lab 2-1: Your First VB Application.
Variables, Constants, and Operators.
Declaring and Assigning Variables.
Scope and Lifetime of Variables.
Converting Data Types.
Arithmetic and Comparison Operators.
Modularizing Your Code—Functions and Subroutines.
Controlling Program Flow.
Flow Control Statements.
Handling Errors and Exceptions.
Unstructured Error Handling.
Structured Exception Handling.
Constructors and Destructors.
Implementing Polymorphism by Using Interfaces.
Events and Thread Synchronization.
The Features of ASP.NET.
The Anatomy of ASP.NET Pages.
The Code Structure of ASP.NET.
Execution Stages and State Management.
The Events Model for the Page Class.
Introducing Web Forms.
VS.NET Web Applications and Other IDE Basics.
Separating Content and Code—the Code-Behind Feature.
Structure and Configuration of the Global.asax File.
Using HTML Controls.
The HTMLForm Control.
The HTMLAnchor Control.
The HTMLButton Control.
The HTMLGenericControl Control.
The HTMLImage Control.
The HTMLInputButton Control.
The HTMLInputCheckBox Control.
The HTMLInputFile Control.
The HTMLInputHidden Control.
The HTMLInputImage Control.
The HTMLInputRadioButton Control.
The HTMLInputText Control.
The HTMLSelect Control.
The HTMLTable, HTMLTableCell, and HTMLTableRow Controls.
The HTMLTextArea Control.
Using Web Controls.
Shared Web Control Properties.
Web Controls for Displaying and Formatting Data.
The Label Control.
The Panel Control.
The Table, TableRow, and TableCell Controls.
Web Controls for Creating Buttons.
The Button Control.
The ImageButton Control.
The LinkButton Control.
Demonstration of Web Button Controls.
Web Control for Inputting Text.
The TextBox Control.
Web Controls for Selecting Choices.
The CheckBox Control.
The RadioButton Control.
The CheckBoxList and RadioButtonList Controls.
Web Controls for Creating Lists.
The ListBox Control.
The DropDownList Control.
Miscellaneous Basic Controls.
The Hyperlink Control.
The Image Control.
Creating a Simple ASP.NET Application.
Lab 3-1: Your First ASP.NET Project.
ASP.NET Page Directives.
The @ Page and @ Control Directives.
The @ Import Directive.
The @ Register Directive.
The @ Assembly Directive.
The @ OutputCache Directive.
ASP.NET Rich Controls.
The Calendar Control.
The AdRotator Control.
The BaseValidator Control.
The RequiredFieldValidator Control.
The CompareValidator Control.
The RangeValidator Control.
The RegularExpressionValidator Control.
The CustomValidator Control.
Data List Controls.
The Repeater Control.
The DataGrid Control.
The DataList Control.
Building the XYZ Corporation Home Page.
Lab 3-2: The XYZ Corporation Home Page.
Authoring a User Control.
Saving State with the StateBag Object.
ASP.NET Intrinsic Objects.
The HttpRequest Object.
The HttpResponse Object.
The HttpServerUtility Object.
The HttpApplicationState Object.
The HttpSessionState Object.
The ObjectContext Object.
Common Features of the .NET Framework Class Library.
Using Data Collections (System.Collections).
The ArrayList Class.
The Stack Class.
The Queue Class.
The Hashtable Class.
Handling File Input/Output and Directories (System.IO).
Reading Text Files.
Writing Text Files.
Using Binary File I/O with the FileStream Object.
Reading Binary Files.
Writing Binary Files.
Performing File Operations.
Getting File Information.
Copying, Moving, and Renaming Files.
Creating, Moving, and Renaming Directories.
Creating and Getting Directory Information.
Accessing Directory Contents.
Watching the File System for Changes (System.IO.FileSystemWatcher).
Using the Windows Event Log (System.Diagnostics).
Working with Active Directory Services (System.DirectoryServices).
Displaying Active Directory Services Contents.
Searching Active Directory Services Contents.
Modifying Active Directory Services Contents.
Using Message Queues (System.Messaging).
Creating a Queue.
Sending a Message to a Queue.
Dequeuing a Message.
Communicating with Servers on the Internet (System.Web and System.Net).
A Simple TCP Client Application.
A Simple TCP Server Application.
Manipulating XML Data (System.XML).
Creating Tree-Based XML Documents.
Loading and Searching Tree-Based XML Documents.
Reading Stream-Based XML Data.
Writing Stream-Based XML Data.
Formatting XML Data for Display.
Sending Internet E-mail (System.Web.Mail).
The Concept of Managed Code Execution.
The Common Language Runtime.
The Common Type System.
Just-in-Time Code Compilation.
COM+ Component Services.
Overview of COM.
Overview of Transactions.
.NET Classes and COM+ Component Services.
Using VB.NET to Develop Managed Components.
Using the Class Library.
Using Component “ing”.
Adding Initialization Code.
Using the Class Library in an Application.
Building VB.NET Serviced Components.
Lab 5-1: An Ordering and Inventory System Made with Serviced Components.
The Need for Web Services.
Standards-Based Functionality (XML and HTTP).
Separation of Data from Presentation.
Overview of Web Services.
The .asmx File.
Web Service Classes and Web Methods.
Web Service Description Language.
Web Service Wire Formats.
Using HTTP GET.
Using HTTP POST.
Using the Simple Object Access Protocol (SOAP).
Web Services Discovery.
Creating a Simple Web Service.
Lab 6-1: The Palindrome Web Service.
Calling Web Services with Proxy Classes.
Creating a Client for a Web Service.
Lab 6-2: A Console Application for the Palindrome Web Service.
Managing State in Web Services.
Using Transactions in Web Services.
Making an Advanced Web Service.
Lab 6-3: An Enhanced Ordering and Inventory System.
Overview of Data Access on the Web.
Legacy or Mainframe Data.
Proprietary Database APIs.
ADO.NET: The Next Generation of Data-Access Technology.
ADO.NET Programming Objects and Architecture.
The DataSet Class.
The .NET Managed Data Provider.
Displaying Database Data.
The IDataReader Interface (System.Data.IDataReader).
Working with Command Parameters.
The DataGrid Control Revisited.
Displaying Data in the DataGrid Control.
Editing Data in the DataGrid Control.
Programming with the DataList and DataGrid Controls.
Lab 7-1: An Online Photo Gallery.
Working with the DataSet and DataTable Objects.
The DataSet Class Summary.
The DataTable Class Summary.
Creating DataSet and DataTable Objects.
Adding Data to a DataTable Object.
Displaying Data in a DataTable Object.
Loading and Updating DataSet Objects with the IDataAdapter Interface.
Filtering and Sorting Data with the DataView Class.
Maintaining Data Integrity with the DataRelation Class.
Using Manual Database Transactions.
Working with Typed DataSet Objects.
Lab 7-2: VS.NET and Typed DataSet Objects.
Windows Security 5
File/Object System Security.
User Rights, Groups, and Policies.
IIS Authentication and Authorization Security.
Integrated Windows Authentication.
Authentication by IP Address and Domain.
A Crash Course in Cryptography.
Public Key Cryptography.
Hashes and Digital Signatures.
Implementing Data Encryption (System.Security.Cryptography).
ASP.NET Authentication Security.
The Forms-Based Authentication Provider.
The Windows Authentication Provider.
The Microsoft Passport Authentication Provider.
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.
One of these tools is a platform from Microsoft called .NET (pronounced dot-net). In short, the .NET platform is a new framework, based on industry standards, for creating Internet applications that deliver on Microsoft's promise of making information available "any time, any place and on any device." To take Internet functionality to the next level, it must be decoupled from the desktop and laptop PC. Devices like the cell phone and PDA now contain Internet connectivity, enabling mobile users the freedom to take advantage of the rich user experience of the desktop PC while "on the go." The .NET platform makes developing applications for these mobile devices easier. Plus, it eliminates the problems of connecting and sharing data across devices that would normally be incompatible, due to differences in operating systems, network protocols, or programming languages. But most important, .NET applications make computers easier to use and makes users more productive. As the Internet becomes more and more a part of our daily lives, the more approachable, productive, and responsive it needs to be. .NET is the application platform to make that happen.
Active Server Pages.NET (ASP.NET), an integral part of the .NET framework, is the key focus of this book. ASP.NET enables the developer to create dynamic web applications; much in the same way desktop applications are created. Web applications can now share the same flow and feel as desktop applications, which enables the user to do more with the PC skills they already have. For the software developer, ASP.NET provides many advantages over other web application development models, in particular the speed at which web application and services can be developed.
This book is also covers Web Services, the faceless applications that will run on Internet servers everywhere. .NET applications that you write will aggregate Web Services. These web services, located in various locations in the Internet cloud (as well as your local area network) will all work together to deliver on the promise of a rich and productive Internet experience for the user.
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 and Web Services as quickly as possible. The approach that I take with this book is unique: I 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 or Web Services work. I'll discuss these topics in a tutorial format, so you can follow and learn, while all the while being productive.
This book is also for students or hobbyist that want to learn about programming web applications and Web Services using the .NET platform. The text of this book is arranged in a discussion/laboratory format, so students and teachers can effectively pick and choose topics and sections that are most relevant to their curriculum.
Even though I'm assuming minimal knowledge of web programming methodologies, I am forced to set a few prerequisites. Since we are working with Web pages for a majority of this book, a working knowledge of basic HTML would be very helpful, which means you should be familiar with the common HTML tags, as well as HTML 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 programming Web Services (more on this later) that will be built using Visual Basic.NET. While I don't specifically require that you have used any previous version of Visual Basic in the past, it would certainly be helpful. This book is geared toward beginner and intermediate developers alike. Ideally, you should have some programming experience with a high-level language, be it with Visual Basic, C++, COBOL, Pascal, or some other language. You should also be familiar with language concepts such as procedures, loops, conditionals, variables, and so on. All of the samples in this book will be coded in Visual Basic.NET.
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.
Why is the focus of this book on ASP.NET and the .NET platform? To put it simply, I believe the .NET platform is what will carry Internet applications to the next level. The .NET platform has set a new standard for programming ease for both browser-based applications as well as Web Services. My goal is to make you productive in the least amount of time using these technologies.
This book is a "follow up" of sorts to "Web Programming with ASP and COM," my first book. I was surprised how much ASP and ASP.NET are radically different technologies. Plus, COM+ and .NET now overshadow traditional COM. For readers of my first book, this will require a paradigm shift in thinking to understand the programming model of .NET. If you are a first-time reader, you're in luck. We approach the material as if you've never been exposed to web application programming, or ASP and COM for that matter.
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.NET and the .NET Framework provide the best environment for this. With easy-to-understand development languages (like Visual Basic) and the code modules in the .NET Framework, developing Web applications becomes very easy.
At the time of this writing, the Microsoft .NET platform requires Windows NT/2000/XP (any version, Professional or Server will work) for server-based applications. The final release of the .NET platform will support legacy versions of Windows (98/NT) for client applications, making the .NET platform more interoperable with older operating systems. When choosing hardware, make sure you have a computer that meets or exceeds the minimum hardware requirements for Windows 2000/XP. This should suffice for your development activities. When in doubt about your particular system configuration, just remember: it will not hurt to add more RAM or hard-drive space to your computer!
As a bare minimum, you can program for the .NET Framework using Windows 98, but with some restrictions. For example, one cannot host any web-based server applications (ASP.NET and Web Services) using Windows 98 (or Windows ME). This requires Windows NT, Windows 2000, or Windows XP. However, any other "client" .NET application can be developed and run on Windows 98 and above systems. This includes console applications, consumers/clients for Web Services, and Windows Forms applications (Windows Forms will not be covered in this book).
Development with the .NET platform on Windows requires the .NET Framework. We'll also make use of the great tools that the Visual Studio.NET environment provides. In this book, we will be developing with the Visual Basic.NET portion of the product. The examples in the book are oriented around using VS.NET as our primary development tool. If obtaining a copy of Visual Studio.NET is not feasible, you may still download the .NET Framework SDK for free from Microsoft's Web site. The .NET Framework SDK contains all the development tools needed to work with the examples in this book, but is limited as far as graphical-based development tools and it doesn't have the ease of use of VS.NET. In support for those users using the .NET Framework SDK by itself, we will provide instructions on how to compile and run many of the samples in this book using the command-line tools that ship with the .NET Framework.
There are some optional software packages that you may find useful to have around while you develop .NET and ASP.NET applications. The examples in the book will use SQL Server 7.0/2000, a powerful, scalable, and robust database management system. Chapter 7 deals with examples that interact with SQL Server, so access to SQL Server will be a requirement. Microsoft offers a trial download of SQL Server 2000 available at http://www.microsoft.com/sql.
This book features many design features to help you get the most out of the information presented. The text is organized in such a way that no matter your skill level, you sure to find the information you need quickly.
This book follows a tutorial format and is geared toward the reader with little or no experience with ASP.NET and the .NET Framwork. At each chapter, an overview is presented where covered topics are listed. The overview is followed by a discussion of each item and a lab exercise(s) pertaining to the discussion. Lab exercises are very pictorial in nature. Screenshots are used to a high degree to guide you through every step of the development process.
As you've probably noticed, paragraph headings are numbered. We number these headings to make finding relevant sections of the text easier.
Code samples may contain line markers. These are to help you reference source code being discussed in the text. Here's a sample source code listing with a line marker.
Function DoThatThingYouDo( n As Integer )
Dim x As Integer
For x = 1 to n
DoIt( x ) (23)
In the text, we would provide an in-line reference to the source code line like this: (23). This allows you to quickly locate the source code we are discussing.
Occasionally, we'll make special mention of topics that will assist you in making your development efforts easier. These are highlighted like this:
Tip: Make sure you stop and smell the roses
We're also watching out for you. There are plenty of opportunities to "shoot yourself in the foot" when developing software. When we see possible danger heading your way, we'll notify you with a warning section:
WARNING: Running with scissors is not a good idea.
Some topics discussed may not have direct relevance to the topic at hand, but may interest the more industrious programmer. Some folks prefer not to listen to it (like me, I enjoy simplicity) but I include it for sake of completeness. We segregate these discussions from the main text like this:
Tech Talk: Here's where a long, detailed, geeky discussion will happen. You can just skip over it if you've forgotten your pocket protector or if this sort of talk doesn't interest you.
Here are some final notes on formatting. Certain unfamiliar terms in the text will be in italic text. Menu commands (such as those in Windows and the Visual Studio.NET development environment) appear in boldface. Also note that some tables, particularly those involving the .NET Framework Class Library have been placed in an Appendix. Some of these reference tables are quite large and have been move to the Appendix for better readability of the text.
When code in the text is available in electronic form, either online or on the CD-ROM, the file will be named as such: csnn-n.vb|aspx|asmx|ascx, which corresponds to the file
csnn-n.ext. Code for the lab exercises are labeled as
Some code samples may also contain a line below the grey code block that shows how to build (compile) the program using the Visual Basic.NET command-line utility, vbc.exe. This is provided for those readers who do not have access to Visual Studio.NET and are using the .NET Framework SDK by itself.
I mean it! I've received quite a bit of feedback from readers of my first book, Web Programming with ASP and COM (thank you readers!) and your continued feedback is very important. I do my best to answer each e-mail personally. While I can't help you with general programming questions, I can certainly respond to any queries you have about material that relates directly with this book. So, please send me your comments, suggestions, rants, raves, and ramblings. My e-mail address is:
I've written the code in this book against the Release Candidate of Visual Studio.NET. While the GA (Generally Available) release of Visual Studio.NET won't be available until sometime after this writing (Microsoft is aiming for Feb 2002), I've prepared this text with the most current version of Visual Studio.NET I could get my hands on. This will ensure that you have the most accurate code at your disposal. But, expect a few changes as Microsoft hammers out the final details of the .NET Framework.
Click below to download the Index file related to this title: