- •About the Authors
- •Contents at a Glance
- •Contents
- •Introduction
- •Goal of the Book
- •How to Use this Book
- •Introduction to the .NET Framework
- •Common Language Runtime (CLR)
- •Class Library
- •Assembly
- •Versioning
- •Exceptions
- •Threads
- •Delegates
- •Summary
- •Introduction to C#
- •Variables
- •Initializing Variables
- •Variable Modifiers
- •Variable Data Types
- •Types of Variables
- •Variable Scope
- •Types of Data Type Casting
- •Arrays
- •Strings
- •Initializing Strings
- •Working with Strings
- •Statements and Expressions
- •Types of Statements
- •Expressions
- •Summary
- •Classes
- •Declaring Classes
- •Inheritance
- •Constructors
- •Destructors
- •Methods
- •Declaring a Method
- •Calling a Method
- •Passing Parameters to Methods
- •Method Modifiers
- •Overloading a Method
- •Namespaces
- •Declaring Namespaces
- •Aliases
- •Structs
- •Enumerations
- •Interfaces
- •Writing, Compiling, and Executing
- •Writing a C# Program
- •Compiling a C# Program
- •Executing a C# Program
- •Summary
- •Arrays
- •Single-Dimensional Arrays
- •Multidimensional Arrays
- •Methods in Arrays
- •Collections
- •Creating Collections
- •Working with Collections
- •Indexers
- •Boxing and Unboxing
- •Preprocessor Directives
- •Summary
- •Attributes
- •Declaring Attributes
- •Attribute Class
- •Attribute Parameters
- •Default Attributes
- •Properties
- •Declaring Properties
- •Accessors
- •Types of Properties
- •Summary
- •Introduction to Threads
- •Creating Threads
- •Aborting Threads
- •Joining Threads
- •Suspending Threads
- •Making Threads Sleep
- •Thread States
- •Thread Priorities
- •Synchronization
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Primary and Foreign Keys
- •Referential Integrity
- •Normalization
- •Designing a Database
- •Low-Level Design
- •Construction
- •Integration and Testing
- •User Acceptance Testing
- •Implementation
- •Operations and Maintenance
- •Summary
- •Creating a New Project
- •Console Application
- •Windows Applications
- •Creating a Windows Application for the Customer Maintenance Project
- •Creating an Interface for Form1
- •Creating an Interface for WorkerForm
- •Creating an Interface for CustomerForm
- •Creating an Interface for ReportsForm
- •Creating an Interface for JobDetailsForm
- •Summary
- •Performing Validations
- •Identifying the Validation Mechanism
- •Using the ErrorProvider Control
- •Handling Exceptions
- •Using the try and catch Statements
- •Using the Debug and Trace Classes
- •Using the Debugging Features of Visual Studio .NET
- •Using the Task List
- •Summary
- •Creating Form1
- •Connecting WorkerForm to the Workers Table
- •Connecting CustomerForm to the tblCustomer Table
- •Connecting the JobDetails Form
- •to the tblJobDetails Table
- •Summary
- •Introduction to the Crystal Reports Designer Tool
- •Creating the Reports Form
- •Creating Crystal Reports
- •Creating the Windows Forms Viewer Control
- •Creating the Monthly Worker Report
- •Summary
- •Introduction to Deploying a Windows Application
- •Deployment Projects Available in Visual Studio .NET
- •Deployment Project Editors
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Low-Level Design
- •Summary
- •Populating the TreeView Control
- •Displaying Employee Codes in the TreeView Control
- •Event Handling
- •Displaying Employee Details in the ListView Control
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Low-Level Design
- •Summary
- •Adding the Programming Logic to the Application
- •Adding Code to the Form Load() Method
- •Adding Code to the OK Button
- •Adding Code to the Exit Button
- •Summary
- •The Created Event
- •Adding Code to the Created Event
- •Overview of XML
- •The XmlReader Class
- •The XmlWriter Class
- •Displaying Data in an XML Document
- •Displaying an Error Message in the Event Log
- •Displaying Event Entries from Event Viewer
- •Displaying Data from the Summary.xml Document in a Message Box
- •Summary
- •Airline Profile
- •Role of a Business Manager
- •Role of a Network Administrator
- •Role of a Line-of-Business Executive
- •Project Requirements
- •Creation and Deletion of User Accounts
- •Addition of Flight Details
- •Reservations
- •Cancellations
- •Query of Status
- •Confirmation of Tickets
- •Creation of Reports
- •Launch of Frequent Flier Programs
- •Summarizing the Tasks
- •Project Design
- •Database Design
- •Web Forms Design
- •Enabling Security with the Directory Structure
- •Summary
- •Getting Started with ASP.NET
- •Prerequisites for ASP.NET Applications
- •New Features in ASP.NET
- •Types of ASP.NET Applications
- •Exploring ASP.NET Web Applications
- •Introducing Web Forms
- •Web Form Server Controls
- •Configuring ASP.NET Applications
- •Configuring Security for ASP.NET Applications
- •Deploying ASP.NET Applications
- •Creating a Sample ASP.NET Application
- •Creating a New Project
- •Adding Controls to the Project
- •Coding the Application
- •Summary
- •Creating the Database Schema
- •Creating Database Tables
- •Managing Primary Keys and Relationships
- •Viewing the Database Schema
- •Designing Application Forms
- •Standardizing the Interface of the Application
- •Common Forms in the Application
- •Forms for Network Administrators
- •Forms for Business Managers
- •Forms for Line-of-Business Executives
- •Summary
- •The Default.aspx Form
- •The Logoff.aspx Form
- •The ManageUsers.aspx Form
- •The ManageDatabases.aspx Form
- •The ChangePassword.aspx Form
- •Restricting Access to Web Forms
- •The AddFl.aspx Form
- •The RequestID.aspx Form
- •The Reports.aspx Form
- •The FreqFl.aspx Form
- •Coding the Forms for LOB Executives
- •The CreateRes.aspx Form
- •The CancelRes.aspx Form
- •The QueryStat.aspx Form
- •The ConfirmRes.aspx Form
- •Summary
- •Designing the Form
- •The View New Flights Option
- •The View Ticket Status Option
- •The View Flight Status Option
- •The Confirm Reservation Option
- •Testing the Application
- •Summary
- •Locating Errors in Programs
- •Watch Window
- •Locals Window
- •Call Stack Window
- •Autos Window
- •Command Window
- •Testing the Application
- •Summary
- •Managing the Databases
- •Backing Up the SkyShark Airlines Databases
- •Exporting Data from Databases
- •Examining Database Logs
- •Scheduling Database Maintenance Tasks
- •Managing Internet Information Server
- •Configuring IIS Error Pages
- •Managing Web Server Log Files
- •Summary
- •Authentication Mechanisms
- •Securing a Web Site with IIS and ASP.NET
- •Configuring IIS Authentication
- •Configuring Authentication in ASP.NET
- •Securing SQL Server
- •Summary
- •Deployment Scenarios
- •Deployment Editors
- •Creating a Deployment Project
- •Adding the Output of SkySharkDeploy to the Deployment Project
- •Deploying the Project to a Web Server on Another Computer
- •Summary
- •Organization Profile
- •Project Requirements
- •Querying for Information about All Books
- •Querying for Information about Books Based on Criteria
- •Ordering a Book on the Web Site
- •Project Design
- •Database Design
- •Database Schema
- •Web Forms Design
- •Flowcharts for the Web Forms Modules
- •Summary
- •Introduction to ASP.NET Web Services
- •Web Service Architecture
- •Working of a Web Service
- •Technologies Used in Web Services
- •XML in a Web Service
- •WSDL in a Web Service
- •SOAP in a Web Service
- •UDDI in a Web Service
- •Web Services in the .NET Framework
- •The Default Code Generated for a Web Service
- •Testing the SampleWebService Web Service
- •Summary
- •Creating the SearchAll() Web Method
- •Creating the SrchISBN() Web Method
- •Creating the AcceptDetails() Web Method
- •Creating the GenerateOrder() Web Method
- •Testing the Web Service
- •Securing a Web Service
- •Summary
- •Creating the Web Forms for the Bookers Paradise Web Site
- •Adding Code to the Web Forms
- •Summary
- •Case Study
- •Project Life Cycle
- •Analyzing Requirements
- •High-Level Design
- •Low-Level Design
- •Summary
- •Overview of Mobile Applications
- •The Microsoft Mobile Internet Toolkit
- •Overview of WAP
- •The WAP Architecture
- •Overview of WML
- •The Mobile Web Form
- •The Design of the MobileTimeRetriever Application
- •Creating the Interface for the Mobile Web Forms
- •Adding Code to the MobileTimeRetriever Application
- •Summary
- •Creating the Forms Required for the MobileCallStatus Application
- •Creating the frmLogon Form
- •Creating the frmSelectOption Form
- •Creating the frmPending Form
- •Creating the frmUnattended Form
- •Adding Code to the Submit Button in the frmLogon Form
- •Adding Code to the Query Button in the frmSelectOption Form
- •Adding Code to the Mark checked as complete Button in the frmPending Form
- •Adding Code to the Back Button in the frmPending Form
- •Adding Code to the Accept checked call(s) Button in the frmUnattended Form
- •Adding Code to the Back Button in the frmUnattended Form
- •Summary
- •What Is COM?
- •Windows DNA
- •Microsoft Transaction Server (MTS)
- •.NET Interoperability
- •COM Interoperability
- •Messaging
- •Benefits of Message Queues
- •Limitations
- •Key Messaging Terms
- •Summary
- •Pointers
- •Declaring Pointers
- •Types of Code
- •Implementing Pointers
- •Using Pointers with Managed Code
- •Working with Pointers
- •Compiling Unsafe Code
- •Summary
- •Introduction to the Languages of Visual Studio .NET
- •Visual C# .NET
- •Visual Basic .NET
- •Visual C++ .NET
- •Overview of Visual Basic .NET
- •Abstraction
- •Encapsulation
- •Inheritance
- •Polymorphism
- •Components of Visual Basic .NET
- •Variables
- •Constants
- •Operators
- •Arrays
- •Collections
- •Procedures
- •Arguments
- •Functions
- •Adding Code to the Submit Button
- •Adding Code to the Exit Button
- •Summary
- •Introduction to Visual Studio .NET IDE
- •Menu Bar
- •Toolbars
- •Visual Studio .NET IDE Windows
- •Toolbox
- •The Task List Window
- •Managing Windows
- •Customizing Visual Studio .NET IDE
- •The Options Dialog Box
- •The Customize Dialog Box
- •Summary
- •Index
430 Project 4 CREATING AN AIRLINE RESERVATION PORTAL
In the previous chapter, Chapter 18, “Project Case Study and Design,” you studied the case of SkyShark Airlines. You also saw the database schema and Web
forms that provide the interface to the application.
All the forms that you viewed in the last chapter are Web forms that are created in ASP.NET. The Web application ASP.NET is the next version of ASP (Active Server Pages) 3.0. However, ASP.NET is quite different from ASP because it includes a completely revamped ASP engine and uses the CLR (common language runtime) environment for running ASP code.
You will see in this chapter that ASP.NET simplifies Web development by allowing you to separate programming logic from the HTML code that is used to display the page. ASP.NET also provides improved caching and debugging support.
You can write programming logic in ASP.NET by using Visual Basic .NET or Visual C#. In this chapter, I will explore the basic concepts related to ASP.NET, which will help you to start creating the SkyShark Airlines project. The subsequent chapters will build on the concepts covered in this chapter and help you consolidate your learning of ASP.NET.
Visual Studio .NET provides a highly user friendly and powerful interface to simplify development in ASP.NET. For example, the ASP.NET Web application and ASP.NET Web service project templates can be conveniently used to develop Web applications and Web services. These templates provide the Web form and HTML controls that allow you to design a Web form without needing to write a single line of code. Another important aspect that I will explain in this chapter is the use of Visual Studio .NET for creating ASP.NET applications.
Getting Started with ASP.NET
ASP.NET is a server-side scripting technology that allows you to create dynamic Web sites. ASP.NET is built upon the .NET framework. In this section, I’ll explore the new features and the types of applications that you can create in ASP.NET. However, before that, I’ll examine the prerequisite software package that is required to create and run ASP.NET applications.
BASICS OF ASP.NET WEB APPLICATIONS |
Chapter 19 |
431 |
|
|
|
|
|
Prerequisites for ASP.NET Applications
ASP.NET is a component of .NET Framework SDK (Software Development Kit). ASP.NET can be downloaded free of cost from the Microsoft site at http://msdn.microsoft.com. The software requirements to install the SDK are specified in the following list:
Windows XP Server or Windows XP Professional
Windows 2000 Server or Windows 2000 Professional
Windows NT 4.0 with Service Pack 6a
IIS (Internet Information Server) 5.0 or a later version
In an enterprise environment, you have different development servers and deployment servers. The development servers are used to develop the applications, and the deployment servers are the Web servers on which the application is deployed. You need not install .NET Framework SDK on the deployment servers. Instead, you can install .NET Framework Redistributable, which is also downloadable from the Microsoft Web site.
New Features in ASP.NET
After having examined the prerequisites to run ASP.NET, I will examine the new features of ASP.NET. The most important features of ASP.NET are specified in the following list:
Compiled code. One of the most prominent differences between ASP and ASP.NET is that the code in ASP.NET is compiled while the code in ASP 3.0 is interpreted. The compilation of code significantly improves the performance of the Web application. It also allows early binding and strong typing of the program code.
Support for multiple programming languages. ASP.NET supports Visual Basic .NET, Visual C#, and JScript. You can use any of these three languages to write your code. You can also use a combination of all three languages to develop your Web application. The development team might code one module for the application in Visual Basic .NET and another in Visual C# and JScript.
Support for WYSIWYG (what you see is what you get) editors. Similar to ASP 3.0, ASP.NET applications can be coded in WYSIWYG
432 Project 4 CREATING AN AIRLINE RESERVATION PORTAL
HTML editors. In this project, the Visual Studio .NET development platform that you will use to develop the SkyShark Airlines project is a WYSIWYG editor.
Improved caching. ASP.NET optimizes the performance of request processing by providing extensive caching support. ASP.NET exposes a cache API to help programmers cache their own objects. This allows programmers to have greater control over caching of their content. The data in ASP.NET can be cached at two levels, page and fragment. Pagelevel caching enables you to cache a complete page, and fragment caching enables the caching of only a part of a page.
Extensive security. ASP.NET applications can use Windows, Forms, and Microsoft Passport authentication mechanisms. In ASP 3.0 applications, security is configured at IIS. ASP.NET takes the security model to the next step by allowing you to configure security at the IIS and Web application. You can also enable directory-level security for your Web application. I will explain ASP.NET security in detail later in this chapter and in Chapter 25, “Securing the Application.”
Debugging and tracing. An important task in application development is debugging and tracing. When you build your ASP.NET application in Visual Studio .NET, you can use the extensive debugging tools and tracing methods to debug your application.
Efficient state management. State management is the process of maintaining state and page information over multiple requests for the same or different pages. ASP.NET provides easy-to-use application and sessionstate capabilities. Session and application data can be stored in userdefined objects, which can be updated or queried from time to time.
Improved data access. The ADO.NET architecture provides a reliable and efficient mode of accessing data. Although the topic of ADO.NET is too complicated to cover in a single chapter, I will use the ADO data objects extensively in this project.These objects are explained as they are used.
After having examined the features of ASP.NET, you can now examine the applications that can be created in ASP.NET.
BASICS OF ASP.NET WEB APPLICATIONS |
Chapter 19 |
433 |
|
|
|
|
|
Types of ASP.NET Applications
InASP.NET, you can create two types of applications: Web applications and Web services. In this section, I include a brief description of these applications.
ASP.NETWeb Applications
ASP.NET Web applications are applications that interact directly with users through the Internet. The Web sites that you commonly browse on the Internet are Web applications. The Web applications that are built using ASP.NET are ASP.NET Web applications. I will explain ASP.NET Web applications in this project in detail.
ASP.NETWeb Services
Consider a scenario where you need to consolidate the data that is available on three data sources and display it on a Web site.The only way to display output by using Web applications is to create different Web applications and provide links to all applications on a Web site. However, consider that the data that you need to access may be stored on legacy systems and the data may be relevant only when it is consolidated and analyzed.
Implementing such a scenario by using Web applications can be a challenging task. Here, the solution is in ASP.NET Web services. Web services expose the functionality provided by one application to other applications. The functionality exposed by a Web service can be implemented by other Web services or applications in a number of ways, depending upon the business requirements of Web service clients. Therefore, a Web service that exposes a product catalog can be displayed on one Web application as a list and on another Web application with the custom search functionality.
Another advantage offered by Web services is that they are platform-independent. Data is exposed by Web services in an XML format, which is the industry standard.Therefore, any device that can interpret XML can make use of the data that is available from the Web service. I will discuss more of Web services in the next professional project, “Project 5: Creating a Web Portal for a Bookstore.”