BN.com Gift Guide

MCAD/MCSD Self-Paced Training Kit: Developing web Applications with Microsoft Visual Basic .NET and Microsoft Visual Basic .NET and Microsoft Visual C# .NET

Overview

Build real-world programming skills—and prepare for MCP Exams 70-305 and 70-315—with this official Microsoft study guide. Work at your own pace through the lessons and hands-on exercises to learn how to build Web applications using Visual Basic .NET and Visual C# .NET. Then extend your expertise through additional skill-building exercises. As you gain practical experience with essential Web development tasks, you’re also preparing for MCAD or ...

See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (27) from $1.99   
  • New (1) from $14.50   
  • Used (26) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$14.50
Seller since 2011

Feedback rating:

(4)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
New Condition not used

Ships from: Murphy, TX

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Close
Sort by
Sending request ...

Overview

Build real-world programming skills—and prepare for MCP Exams 70-305 and 70-315—with this official Microsoft study guide. Work at your own pace through the lessons and hands-on exercises to learn how to build Web applications using Visual Basic .NET and Visual C# .NET. Then extend your expertise through additional skill-building exercises. As you gain practical experience with essential Web development tasks, you’re also preparing for MCAD or MCSD certification for Microsoft .NET.

Learn how to:

  • Use Microsoft ASP.NET to build Web Forms applications
  • Create user services, including user input, localization features, and online help
  • Access and modify data with Microsoft ADO.NET
  • Build and reuse custom Web controls
  • Manage application appearance and behavior with style sheets and XML
  • Configure security features for Web applications, including authentication and authorization
  • Test and debug coding errors
  • Deploy applications to your server or hosting service
  • Maintain and optimize applications

Your kit includes:

  • NEW—60-day evaluation version of Microsoft Visual Studio® .NET 2003 Professional Edition on DVD
  • Comprehensive self-paced study guide that maps to the objectives of the final exams
  • NEW—Expanded coverage on delegates, events, unmanaged code, COM, and installation programs, plus a new chapter on caching
  • NEW—150 challenging practice questions on CD. Test yourself by exam (70-305 or 70-315) or by individual objective(s). Choose the number of questions and timed or untimed mode. You get automated scoring and detailed explanation for both correct and incorrect answers.
  • NEW—20-question interactive game
  • NEW—300+ revised and tested code samples and labs for Visual C# .NET and Visual Basic .NET
  • Learn-by-doing exercises for skills you can apply to the job
  • Fully searchable eBook

A Note Regarding the CD or DVD

The print version of this book ships with a CD or DVD. For those customers purchasing one of the digital formats in which this book is available, we are pleased to offer the CD/DVD content as a free download via O'Reilly Media's Digital Distribution services. To download this content, please visit O'Reilly's web site, search for the title of this book to find its catalog page, and click on the link below the cover image (Examples, Companion Content, or Practice Files). Note that while we provide as much of the media content as we are able via free download, we are sometimes limited by licensing restrictions. Please direct any questions or concerns to booktech@oreilly.com.

Read More Show Less

Product Details

  • ISBN-13: 9780735619272
  • Publisher: Microsoft Press
  • Publication date: 4/23/2003
  • Edition description: REV
  • Edition number: 2
  • Pages: 864
  • Product dimensions: 7.63 (w) x 9.29 (h) x 1.75 (d)

Meet the Author

Jeff Webb is a SharePoint consultant and trainer who has written about computers and technology for 20 years. Among his published O'Reilly titles are Essential SharePoint, SharePoint Office Pocket Guide, Programming Excel with VBA and .NET, and Excel 2003 Programming: A Developer's Notebook. Jeff was an original member of Microsoft's Visual Basic team.

Developed by senior editors and content managers at Microsoft Corporation.

Read More Show Less

Table of Contents

About This Book

Chapter 1: Introduction to Web Programming

Chapter 2: Creating Web Forms Applications

Chapter 3: Working with Web Objects

Chapter 4: Creating a User Interface

Chapter 5: Storing and Retrieving Data with ADO.NET

Chapter 6: Catching and Correcting Errors

Chapter 7: Advanced Web Forms Programming

Chapter 8: Maintaining Security

Chapter 9: Building and Deploying Web Applications

Chapter 10: Testing Web Applications

Chapter 11: Creating Custom Web Controls

Chapter 12: Optimizing Web Applications with Caching

Chapter 13: Formatting Web Application Output

Chapter 14: Providing Help

Chapter 15: Globalizing Web Applications

Questions and Answers

Glossary

Read More Show Less

First Chapter

  • Lesson 1: Types of Applications
  • Lesson 2: Using ASP.NET
  • Lesson 3: Using Visual Studio .NET
  • Summary
  • Lab: Getting Started with Visual Studio .NET
  • Review

Chapter 1  Introduction to Web Programming

About This Chapter

In this chapter, you will learn about Internet applications and the tools you use to create them. This chapter introduces you to the concepts and terms used throughout this book, including how ASP.NET Web applications work, the parts of a Web application, how the Microsoft .NET Framework is organized, and how to use the Microsoft Visual Studio .NET programming environment. The sections in this chapter will provide a high-level overview of concepts that are explained in greater detail in subsequent chapters.

Before You Begin

To complete the lessons in this chapter, you must have:

  • Installed Visual Studio .NET on your computer
  • Internet access through a local area network (LAN), broadband, or modem connection

Lesson 1: Types of Applications

Web applications are one of four types of Internet applications that you can create using Visual Studio .NET. In this lesson, you will learn a little about the different types of Internet applications and get an overview of how an ASP.NET Web application works.


After this lesson, you will be able to
  • Describe four different types of Internet applications and know where to look for training on developing each type of application
  • Explain how a Web application executes over the Internet and how that differs from a traditional, static Web site
  • Understand the role that ASP.NET plays in creating Web applications
  • List the parts that make up ASP.NET and describe some of its advantages over other Web application technologies, such as the Common Gateway Interface (CGI)

Estimated lesson time: 5 minutes


What Can You Create?

Strictly speaking, an Internet application is any application that uses the Internet in any way. That means applications that request that users register over the Internet or that provide Help through the Internet are, to some degree, Internet applications.

That definition is too broad for the subject of a single book. To narrow the focus a bit, let’s identify four types of Internet applications:

  • Web applications These applications provide content from a server to client machines over the Internet. Users view the Web application through a Web browser.
  • Web services These components provide processing services from a server to other applications over the Internet.
  • Internet-enabled applications These are stand-alone applications that incorporate aspects of the Internet to provide online registration, Help, updates, or other services to the user over the Internet.
  • Peer-to-peer applications These are stand-alone applications that use the Internet to communicate with other users running their own instances of the application.

You can use Visual Studio .NET to create each of these types of applications. The first type, Web applications, is the subject of this book. Table 1-1 shows the Visual Studio .NET Help topics and the books in this series that deal with each type of Internet application.

Table 1-1  Sources of Information About Internet Applications

Application type Use these topics in online Help Prepare for the MCSD test using
Web applications ASP.NET, Web forms, System.Web namespace This book
Web services ASP.NET, XML Web Services, System.Web.Services namespace MCAD/MCSD Self-Paced Training Kit: Developing XML Web Services and Server Components with Microsoft Visual Basic .NET and Microsoft Visual C# .NET
Internet-enabled applications Microsoft Windows forms, HTML Help, WebBrowser control, System.Net namespace MCAD/MCSD Self-Paced Training Kit: Developing Windows-Based Applications with Microsoft Visual Basic .NET and Microsoft Visual C# .NET
Peer-to-peer applications Accessing the Internet, pluggable protocols, System.Net and System.Net.Sockets namespaces Online Help topics for these namespaces and MSDN articles on peer-to-peer and client/server applications with the .NET Framework

How Web Applications Work

Web applications use a client/server architecture. The Web application resides on a server and responds to requests from multiple clients over the Internet, as shown in Figure 1-1.

Figure 1-1  ASP.NET Web application architecture (Image unavailable)

On the client side, the Web application is hosted by a browser. The application’s user interface takes the form of Hypertext Markup Language (HTML) pages that are interpreted and displayed by the client’s browser.

On the server side, the Web application runs under Microsoft Internet Information Services (IIS). IIS manages the application, passes requests from clients to the application, and returns the application’s responses to the client. These requests and responses are passed across the Internet using Hypertext Transport Protocol (HTTP). A protocol is a set of rules that describe how two or more items communicate over a medium, such as the Internet. Figure 1-2 shows how the client and server interact over the Internet.

Figure 1-2  Client/server interaction in a Web application (Image unavailable)

The Web application composes responses to requests from resources found on the server. These resources include the executable code running on the server (what we traditionally think of as the "application" in Microsoft Windows programming), Web forms, HTML pages, image files, and other media that make up the content of the application.

Web applications are much like traditional Web sites, except that the content presented to the user is actually composed dynamically by executable, rather than being served from a static page stored on the server. Figure 1-3 shows how a Web application composes the HTML returned to a user.

Figure 1-3  An ASP.NET Web application response from server resources (Image unavailable)

The executable portion of the Web application enables you to do many things that you can’t do with a static Web site, such as:

  • Collect information from the user and store that information on the server
  • Perform tasks for the user such as placing an order for a product, performing complex calculations, or retrieving information from a database
  • Identify a specific user and present an interface that is customized for that user
  • Present content that is highly volatile, such as inventory, pending order, and shipment information

This is only a partial list. Basically, you can do anything with a Web application that you can imagine doing with any client/server application. What makes a Web application special is that the client/server interaction takes place over the Internet.

What ASP.NET Provides

ASP.NET is the platform that you use to create Web applications and Web services that run under IIS. ASP.NET is not the only way to create a Web application. Other technologies, notably the CGI, also enable you to create Web applications. What makes ASP.NET special is how tightly it is integrated with the Microsoft server, programming, data access, and security tools.

ASP.NET provides a high level of consistency across Web application development. In a way, this consistency is similar to the level of consistency that Microsoft Office brought to desktop applications. ASP.NET is part of the .NET Framework and is made up of several components.

  • Visual Studio .NET Web development tools   These include visual tools for designing Web pages and application templates, project management, and deployment tools for Web applications.
  • The System.Web namespaces   These are part of the .NET Framework and include the programming classes that deal with Web-specific items such as HTTP requests and responses, browsers, and e-mail.
  • Server and HTML controls.   These are the user-interface components that you use to gather information from and provide responses to users.

In addition to the preceding components, ASP.NET also uses the following, more general programming components and Windows tools. These items aren’t part of ASP.NET. However, they are key to ASP.NET programming.

  • Microsoft Internet Information Services (IIS). As mentioned in the previous section, IIS hosts Web applications on the Windows server.
  • The Microsoft Visual Basic .NET, Microsoft Visual C#, and Microsoft Visual J# programming languages. These three languages have integrated support in Visual Studio .NET for creating Web applications.
  • The .NET Framework. This is the complete set of Windows programming classes, including the ASP.NET classes as well as classes for other programming tasks such as file access, data type conversion, array and string manipulation, and so on.
  • Microsoft ADO.NET database classes and tools These components provide access to Microsoft SQL Server and ODBC databases. Data access is often a key component of Web applications.
  • Microsoft Application Center Test (ACT). This Visual Studio .NET component provides an automated way to stress-test Web applications.

ASP.NET is the most complete platform for developing Web applications that run under IIS. However, it is important to remember that ASP.NET is not platform-independent. Because it is hosted under IIS, ASP.NET must run on Windows servers. To create Web applications that run on non-Windows/IIS servers, such as Linux/Apache, you must use other tools—generally CGI.

Advantages of ASP.NET

ASP.NET has many advantages over other platforms when it comes to creating Web applications. Probably the most significant advantage is its integration with the Windows server and programming tools. Web applications created with ASP.NET are easier to create, debug, and deploy because those tasks can all be performed within a single development environment—Visual Studio .NET.

ASP.NET delivers the following other advantages to Web application developers:

  • Executable portions of a Web application compiled so they execute more quickly than interpreted scripts
  • On-the-fly updates of deployed Web applications without restarting the server
  • Access to the .NET Framework, which simplifies many aspects of Windows programming
  • Use of the widely known Visual Basic programming language, which has been enhanced to fully support object-oriented programming
  • Introduction of the new Visual C# programming language, which provides a type-safe, object-oriented version of the C programming language
  • Automatic state management for controls on a Web page (called server controls) so that they behave much more like Windows controls
  • The ability to create new, customized server controls from existing controls
  • Built-in security through the Windows server or through other authentication/authorization methods
  • Integration with ADO.NET to provide database access and database design tools from within Visual Studio .NET
  • Full support for Extensible Markup Language (XML), cascading style sheets (CSS), and other new and established Web standards
  • Built-in features for caching frequently requested Web pages on the server, localizing content for specific languages and cultures, and detecting browser capabilities

Lesson 2: Using ASP.NET

In this lesson, you will learn how ASP.NET organizes a Web application into parts, and you will learn the roles and names of those parts. You will be introduced to Web forms, which are the central user-interface element of Web applications.

ASP.NET is part of the larger .NET Framework, so this lesson will also discuss how the .NET Framework is organized and how .NET applications run differently from the traditional Windows applications you might be used to.

Finally, this lesson ends with a discussion of the programming languages you can use to create Web applications. ASP.NET is not bound to any one programming language, and the end of this lesson lists some of the other available languages and explains some of the major differences between the two languages (Visual Basic .NET and Visual C#) featured in this book.


After this lesson, you will be able to
  • List the parts of a Web application and describe how they run on the server
  • Explain how a Web form differs from and is similar to both an HTML page and a Windows form
  • Describe some of the different components you can place on a Web form
  • Explain the parts of the .NET Framework and how the common language runtime (CLR) executes .NET applications
  • Understand how the .NET Framework is organized and know where to look for classes that handle common application programming tasks
  • Compare the Visual Basic .NET and Visual C# programming languages

Estimated lesson time: 10 minutes


Parts of a Web Application

A Web application consists of three parts: content, program logic, and Web configuration information. Table 1-2 summarizes these parts and gives examples of where they reside in an ASP.NET Web application.

Table 1-2  Parts of an ASP.NET Web Application

Part Types of files Description
Content Web forms, HTML, images, audio, video, other data Content files determine the appearance of a Web application. They can contain static text and images as well as elements that are composed on the fly by the program logic (as in the case of a database query).
Program logic Executable files, scripts The program logic determines how the application responds to user actions. ASP.NET Web applications have a dynamic-link library (DLL) file that runs on the server, and they can also include scripts that run on the client machine.
Configuration Web configuration file, style sheets, IIS settings The configuration files and settings determine how the application runs on the server, who has access, how errors are handled, and other details.

The Web form is the key element of a Web application. A Web form is a cross between a regular HTML page and a Windows form. It has the same appearance as and similar behavior to an HTML page, but it also has controls that respond to events and run code, like a Windows form.

In a completed Web application, the executable portion of the Web form is stored in an assembly (.dll) that runs on the server under the control of the ASP.NET worker process (asp_wp.exe), which runs in conjunction with IIS. The content portion of the Web form resides in a content directory of the Web server, as shown in Figure 1-4.

Figure 1-4  ASP.NET Web application parts on a Web server (Image unavailable)

When a user navigates to one of the Web forms from his or her browser, the following sequence occurs:

  1. IIS starts the ASP.NET worker process if it is not already running. The ASP.NET worker process loads the assembly associated with the Web form.
  2. The assembly composes a response to the user based on the content of the Web form that the user requested and any program logic that provides dynamic content.
  3. IIS returns the response to the user in the form of HTML.

Once the user gets the requested Web form, he or she can enter data, select options, click buttons, and use any other controls that appear on the page. Some controls, such as buttons, cause the page to be posted back to the server for event processing, and the sequence repeats itself, as shown in Figure 1-5.

Figure 1-5  How the parts interact (Image unavailable)

This cycle of events is described in greater detail in Lesson 2 of Chapter 2, "Creating Web Forms Applications."

Web Form Components

Web forms can contain several different types of components, as summarized in Table 1-3.

Table 1-3  Components on a Web Form

Component Examples Description
Server controls TextBox, Label, Button, ListBox, DropDownList, DataGrid These controls respond to user events by running event procedures on the server. Server controls have built-in features for saving data that the user enters between page displays. You use server controls to define the user interface of a Web form.
HTML controls Text Area, Table, Image, Submit Button, Reset Button These represent the standard visual elements provided in HTML. HTML controls are useful when the more complete feature set provided by server controls is not needed.
Data controls SqlConnection, SqlCommand, OleDbConnection, OleDbCommand, DataSet Data controls provide a way to connect to, perform commands on, and retrieve data from SQL and OLE databases and XML data files.
System components FileSystemWatcher, EventLog, MessageQueue These components provide access to various system-level events that occur on the server.

You use the server and HTML controls to create the user interface on a Web form. The data controls and system components appear on the Web form only at design time to provide a visual way for you to set their properties and handle their events. At run-time, data controls and system components do not have a visual representation. Figure 1-6 shows a Web form containing components.

Figure 1-6  A Web form with components (Image unavailable)

Chapter 4, "Creating a User Interface," provides more detail about using server and HTML controls on a Web form.

The .NET Framework

ASP.NET is an important part of the .NET Framework, but it is just one part. Understanding what else the .NET Framework provides will help you program your ASP.NET application effectively and avoid writing new code to perform tasks that are already implemented within the .NET Framework.

First, a little background. The .NET Framework is the new Microsoft programming platform for developing Windows and Web software. It is made up of two parts:

  • An execution engine called the common language runtime (CLR)
  • A class library that provides core programming functions, such as those formerly available only through the Windows API, and application-level functions used for Web development (ASP.NET), data access (ADO.NET), security, and remote management

.NET applications aren’t executed the same way as the traditional Windows applications you might be used to creating. Instead of being compiled into an executable containing native code, .NET application code is compiled into Microsoft intermediate language (MSIL) and stored in a file called an assembly. At run time, the assembly is compiled to its final state by the CLR. While running, the CLR provides memory management, type-safety checks, and other run-time tasks for the application. Figure 1-7 shows how this works.

Figure 1-7  How a .NET application runs (Image unavailable)

Applications that run under the CLR are called managed code because the CLR takes care of many of the tasks that would have formerly been handled in the application’s executable itself. Managed code solves the Windows programming problems of component registration and versioning (sometimes called DLL hell) because the assembly contains all the versioning and type information that the CLR needs to run the application. The CLR handles registration dynamically at run time, rather than statically through the system registry as is done with applications based on the Component Object Model (COM).

The .NET class library provides access to all the features of the CLR. The .NET class library is organized into namespaces. Each namespace contains a functionally related group of classes. Table 1-4 summarizes the .NET namespaces that are of the most interest to Web application programmers.

Table 1-4  Summary of the .NET Framework Class Library

Category Namespaces Provides classes for
Common types System All the common data types, including strings, arrays, and numeric types. These classes include methods for converting types, for manipulating strings and arrays, and for math and random number tasks.
Data access System.Data, System.Data.Common, System.Data.OleDb, System.Data.SqlClient, System.Data.SqlTypes Accessing databases. These classes include methods for connecting to databases, performing commands, retrieving data, and modifying data.
Debugging System.Diagnostics Debugging and tracing application execution.
File access System.IO, System.IO.IsolatedStorage, System.DirectoryServices Accessing the file system. These include methods for reading and writing files and getting paths and filenames.
Network communication System.Net, System.Net.Sockets Communicating over the Internet using low-level protocols such as TCP/IP. These classes are used when you’re creating peer-to-peer applications.
Security System.Security, System.Security.Cryptography, System.Security.Permissions, System.Security.Policy, System.Web.Security Providing user authentication, user authorization, and data encrypting.
Web applications System.Web, System.Web.Caching, System.Web.Configuration, System.Web.Hosting, System.Web.Mail, System.Web.SessionState, System.Web.UI, System.Web.UI.Design, System.Web.UI.WebControls, System.Web.UI.HtmlControls Creating client/server applications that run over the Internet. These are the core classes used to create ASP.NET Web applications.
Web services System.Web.Services, System.Web.Services.Configuration, System.Web.Services.Description, System.Web.Services.Discovery, System.Web.Services.Protocols Creating and publishing components that can be used over the Internet. These are the core classes used to create ASP.NET Web services.
Windows applications System.Windows.Forms, System.Windows.Forms.Design Creating applications using Windows user interface components. These classes provide Windows forms and controls as well as the ability to create custom controls.
XML data System.Xml, System.Xml.Schema, System.Xml.Serialization, System.Xml.Xpath, System.Xml.Xsl Creating and accessing XML files.

Because the .NET namespaces organize classes by function, you can use them to help locate the classes and class members that provide the CLR features you want to use. For example, the System namespace is one of the most commonly used namespaces because it contains the classes for all the fundamental data types. Any time you declare a variable with a numeric, a string, or an array type, you are using the System namespace.

This approach allows the .NET Framework to provide built-in methods for converting data types and manipulating strings and arrays. For instance, the following lines of code use the built-in methods of the String and Array classes to sort a list.

Visual Basic .NET

‘ Declare and initialize a string.
Dim strFruit As String = "oranges apples peaches kumquats nectarines mangos"
‘ Declare an array.
Dim arrFruit As String()
‘ Place each word in an array element.
arrFruit = strFruit.Split(" ")
‘ Sort the array.
System.Array.Sort(arrFruit)
‘ Put the sorted data back in the string.
strFruit = String.Join(" ", arrFruit)

Visual C#

// Declare and initialize a string.
string strFruit = "oranges apples peaches kumquats nectarines mangos";
// Declare an array.
string[] arrFruit;
// Place each word in an array element.
arrFruit = strFruit.Split(" ".ToCharArray());
// Sort the array.
System.Array.Sort(arrFruit);
// Put the sorted array back in the string.
strFruit = System.String.Join(" ", arrFruit);

Many of the class methods in the System namespace can be used directly without first creating an object from the class. These are called shared members in Visual Basic .NET and static members in Visual C#. Shared and static members can be called from the class name itself, as in the System.Array.Sort line in the preceding code. Another example of a class with shared/static members is the Math class, as shown by the following Pi and Pow methods:

Visual Basic .NET

‘ Get the area of a circle.
dblCircArea = System.Math.Pi * System.Math.Pow(intRadius, 2)

Visual C#

// Get the area of a circle.
dblCircArea = System.Math.PI * System.Math.Pow(intRadius, 2) ;

The .NET Framework provides 124 different namespaces. Only about 40 of the most common ones are summarized in Table 1-4. For a list of the .NET Framework namespaces, see the topic titled "Class Library" in the Visual Studio .NET online Help.

Programming Languages

ASP.NET and, indeed, the whole .NET Framework are programming language–independent. This means that you can choose any language that has implemented a CLR-compliant compiler. In addition to developing its own programming languages, Microsoft has formed partnerships with many language vendors to provide .NET support for Perl, Pascal, Eiffel, Cobol, Python, Smalltalk, and other programming languages.

This book covers creating Web applications with the Visual Basic .NET and the Visual C# programming languages. These two languages are functionally equivalent, which means that they each provide equal capabilities to create Web applications. The differences between the two languages are syntactical and stylistic.

Most current programmers will choose the language they are most familiar with. Current Visual Basic programmers will be more comfortable developing Web applications in Visual Basic .NET; C or C++ programmers will be more comfortable developing with Visual C#.

If you are new to programming or if you are choosing to extend your programming skills to new languages, learning both Visual Basic .NET and Visual C# is a practical goal. This is especially true when you create Web applications, because most of the tasks are performed through the .NET Framework classes, which means Visual Basic .NET code and Visual C# code often look nearly identical.

Table 1-5 summarizes some significant differences between Visual Basic .NET and Visual C#. This information is useful to keep in mind if you are choosing a programming language for the first time or if you are planning to switch between languages.

Table 1-5  Visual Basic .NET and Visual C# Differences

Feature Visual Basic .NET Visual C# .NET
Case sensitive Not case sensitive:

response.write("Yo") ’ OK

Case sensitive:

response.write("Yo"); //  Error!
Response.Write("Yo"); //  OK

Functional blocks Use beginning and ending statements to declare functional blocks of code:

Sub Show(strX as String)
  Response.Write(strX)
End Sub

Use braces to declare functional blocks of code:

void Show(string strX)
{
  Response.Write(strX);
}

Type
conversion
Implicit type conversions are permitted by default:

Dim X As Integer
X = 3.14  ’ OK

You can limit conversions by including an Option Strict On statement at the beginning of modules.

Implicit type conversions are limited to operations that are guaranteed not to lose information, such as converting from int to float:

int X = 0;
float Y = X; // OK

Other type conversions are performed explicitly by casts:

Y = 3.14F;
X = (int)Y; //Cast, OK.

Or, by using type conversion methods:

string Z;
Z = Y.ToString();

Comments Comments always start with an apostrophe (‘):

‘ This is a comment.

There are three different types of comments: block (/* */), inline (//), and documentation (///):

/* Block comments can
span lines or be used
to comment out code. */
 
// Inline comments appear
// to the right of code.
 
/// <summary>Description 
/// of class.</summary> For more information about documentation comments, see the "XML Documentation" topic in the Visual Studio online Help.

Arrays Array elements are specified using
parentheses:

arrFruit(1) = "Apple"

Array elements are specified using square brackets:

arrFruit[1] = "Apple";

Methods You can omit parentheses after method names if arguments are omitted:

strX = objX.ToString

You must include parentheses after all methods:

strX = objX.ToString();

Statement termination Statements are terminated by carriage return:

Response.Write("Hello")

Statements are terminated by the semicolon (;):

Response.Write("Hello");

Statement continuation Statements are continued using the underscore (_):

intX = System.Math.PI * _
  intRadius

Statements continue until the semicolon (;) and can span multiple lines if needed:

intX = System.Math.PI * 
  intRadius;

String operator Use the ampersand (&) or plus sign (+) to join strings:

strFruit = "Apples" & _
" Oranges"

Use the plus sign (+) to join strings:

strFruit = "Apples" + 
" Oranges";

Comparison operators Use =, >, <, >=, <=, <> to compare values:

If intX >= 5 Then

Use ==, >, <, >=, <=, != to compare values:

if (intX >= 5)

Negation Use the Not keyword to express logical negation:

If Not IsPostBack Then

Use the ! operator to express logical negation:

if (!IsPostBack)

Object comparison Use the Is keyword to compare object variables:

If objX Is objY  Then

Use == to compare object variables:

if (objX == objY)

Object existence Use the Nothing keyword or the IsNothing function to check whether an object exists:

If IsNothing(objX) Then

Use the null keyword to check whether an object exists:

if (objX == null)

In addition to the differences shown in Table 1-5, there are significant keyword differences between the two languages. The code examples throughout this book illustrate those differences. The Visual Studio .NET Help topic "Language Equivalents" provides a complete comparison of Visual Basic .NET, Visual C#, and other Microsoft languages.

Lesson 3: Using Visual Studio .NET

The Visual Studio .NET programming environment presents new window types, new ways to manage those windows, and new integration with Internet content. This lesson offers a tour of these new features as well as an overview of some of the older Visual Studio .NET debugging and Help features presented from a Web application–programming viewpoint.

If you’ve programmed with earlier versions of Visual Studio and feel like skipping this lesson, be aware that you can no longer make changes to an application while debugging without restarting the application. That particular Visual Studio .NET feature, called edit-and-continue, is no longer available in Visual Basic .NET or Visual C#.


After this lesson, you will be able to
  • Use the Start Page to open new or existing projects, get current product information, and set environment preferences
  • List the two Visual Studio .NET window types and use the Auto Hide feature to make the most out of screen space for editing documents
  • Cut and paste items using the Clipboard Ring in the Toolbox
  • Edit Web forms and HTML pages visually or in HTML
  • Write code using the Code Editor’s automated features and modify Visual Studio .NET settings to turn those features on or off
  • Build, run, and debug applications using Visual Studio .NET
  • Get Help and set Help filters for your preferred programming language

Estimated lesson time: 30 minutes


The Start Page

When you start Visual Studio .NET, the first thing you see is the Start Page, shown in Figure 1-8. The Start Page contains various panes to make information easier to find and to help simplify some common tasks, such as opening a recent file.

The Projects pane, shown in Figure 1-8, displays the four most recently saved projects in the form of hyperlinks. To open one of these recent projects, click the project name. To create a new project or to open an existing project not displayed in the recent projects list, click the appropriate button on the Projects tab.

To the left of the Start Page is a list of other topics containing current information about Visual Studio .NET, other Microsoft products, programming, Web site hosting, and other information. If you click one of these topics, the Start Page displays the topic, as shown in Figure 1-9.

Figure 1-8  The Visual Studio .NET Start Page (Image unavailable)

Figure 1-9  Current Visual Studio .NET headlines (Image unavailable)

The information displayed in the Start Page is dynamic, with much of the information coming from the Internet. This ensures that the information is current; it’s a good idea to check the Headlines and Downloads panes occasionally to get the latest news.

Of particular interest to Web application developers is the Web Hosting pane, shown in Figure 1-10. This pane links to Web sites that will host your ASP.NET Web applications on the Internet.

Figure 1-10  ASP.NET hosting services (Image unavailable)

Some of the sites, like Brinkster, offer limited free hosting. These hosting services are extremely useful when you’re learning ASP.NET because they allow you to share your work with the world without the effort and expense of setting up your own Web server.

The My Profile pane of the Start Page lets you set your preferences for Visual Studio .NET, as shown in Figure 1-11.

These options let you change the default window layout for Visual Studio .NET, set the programming language you most commonly use, and specify whether Help is displayed in the Visual Studio .NET design panes or in a window as a separate application. The Help window can get a little cramped when displayed within Visual Studio .NET, so unless you have a 19-inch monitor, it’s a good idea to select the External Help option.

Figure 1-11  Set your preferences in the My Profile pane (Image unavailable)

Visual Studio .NET Windows

Visual Studio .NET has two types of windows: Document windows and Tool windows. Document windows display the content of your application: the forms, Web pages, and code all appear in Document windows. You can have multiple Document windows open at once, and you can choose between them by clicking their tabs near the top of the screen, as shown in Figure 1-12.

Tool windows display the components you use to create your application. These components include the controls, database connections, classes, and properties you use in the project. Tool windows are displayed to the left and right of the Document windows and they can be set to slide in or out of view by clicking their tabs, as shown in Figure 1-13.

Figure 1-12  A Document window (Image unavailable)

Figure 1-13  The Toolbox window (Image unavailable)

To cause a tabbed Tool window to remain on screen, toggle the Auto Hide button at the top right of the Tool window. The Auto Hide button looks like a tiny pushpin. Click the pushpin again to cause the Tool window to return to tabbed display. You can use the tabbed display to hide the Tool windows on both sides of the Document window and provide more space for editing your application’s content, as shown in Figure 1-14.

Figure 1-14  Tabbed Tool windows around the Document window (Image unavailable)

The tabbed display of the Document and Tool windows is the default setting for Visual Studio .NET. You can turn off this feature to use a more traditional windowed display by choosing Options from the Tools menu and then selecting your preferences from the dialog box shown in Figure 1-15.

Figure 1-15  The Options dialog box (Image unavailable)

The Toolbox

The Visual Studio .NET Toolbox displays the controls and components you can add to a Document window. The contents of the Toolbox change depending on the type of document you are currently editing. When you are editing a Web form, for example, the Toolbox displays the server controls, HTML controls, data controls, and other components that you can add to a Web form, as shown in Figure 1-16.

Figure 1-16  The Toolbox window (Image unavailable)

The components in the Toolbox are categorized as shown in Figure 1-16. When you click one of the categories, the Toolbox displays the items in that category. You can scroll through the items in the Toolbox by clicking the up and down arrows at the top and the bottom of the component list.

When the current document is code, the Toolbox contains only the Clipboard Ring, as shown in Figure 1-17. The Clipboard Ring keeps track of the last 20 items you have copied (Ctrl+C) or cut (Ctrl+X) so that you can paste them back into a document.

To paste an item from the Clipboard Ring, click the item and drag it to where you want to insert it. When you move the mouse pointer over an item in the Clipboard Ring, Visual Studio expands that item to show you more of the text it contains.

Figure 1-17  The Clipboard Ring in the Toolbox window (Image unavailable)

Editing Web Documents

You can edit Web forms and HTML documents visually by using the same drag-and-drop techniques that you use when editing Windows forms, or you can edit them as text files. To switch between edit modes, click the Design or HTML tabs at the bottom of the Document window, as shown in Figure 1-18.

Figure 1-18  A Web document in Design mode (Image unavailable)

There is no way to do some tasks visually, so you will often need to edit Web documents as text. Using the HTML mode can also be more convenient than using the visual tools if you are already familiar with HTML. The IntelliSense technology in Visual Studio .NET provides help for completing HTML elements, as shown in Figure 1-19.

Figure 1-19  IntelliSense for HTML elements in Visual Studio .NET (Image unavailable)

You can switch back to Design mode to preview any changes you make in HTML mode simply by clicking on the Design tab at the bottom of the Document window.

Editing Code-Behind Files

Web forms have code files associated with them. These files are created automatically when you create a new Web form and are called code-behind files. Code-behind files have the same base name as the Web form with the .vb or .cs filename extension added, as shown in Figure 1-20 and Figure 1-21.

Figure 1-20  A Web form’s code-behind file (Visual Basic .NET) (Image unavailable)

Figure 1-21  A Web form’s code-behind file (Visual C#) (Image unavailable)

A Web form is associated with its code file by the @Pagedirective found in the Web form’s HTML, as shown here:

Visual Basic .NET

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="Form1.aspx.vb" Inherits="WebApplication1.Webform1"%>

Visual C#

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm1" %>

Visual Studio automatically maintains the file information in this Page directive, so if you save the Web form with a different file name, the CodeBehind attribute is automatically updated. However, Visual Studio does not automatically maintain the information in the Page directive’s Inherits attribute. If you change the root namespace of the project or class name of a Web form, you must manually update the information in the Web form’s Page directive.

Visual Studio .NET generates a class definition, initialization procedure, and Page_Load event procedure for each Web form’s code-behind file. You shouldn’t change the code in the regions marked Web Form Designer Generated Code, because that code might later be modified by Visual Studio .NET and your changes could be overwritten.

You can hide the generated code by clicking the minus sign (-) to the left of the #Region directive. Clicking the minus sign collapses the region into a single line and changes the minus sign to a plus sign (+), which you can click to expand the region again. You can use this same outlining feature to collapse or expand other blocks of code, such as class definitions and procedures.

The Visual Studio .NET Code Editor also provides completion through IntelliSense for keywords and class members that you use in code, as shown in Figure 1-22.

Figure 1-22  The autocomplete feature (Image unavailable)

If you are programming in Visual Basic, the autocomplete feature will also correct the capitalization of keywords and member names when you complete a line. If you are using Visual C#, however, Visual Studio .NET will not recognize a keyword or member name if it is not capitalized correctly. This is because Visual Basic .NET is not case sensitive, but Visual C# is.

The Visual Studio .NET Code Editor highlights syntax errors and undeclared variables as you complete each line. These errors are underlined with a squiggly line, and if you move the mouse pointer over the error, a description of the error is displayed, as shown in Figure 1-23.

You can turn most of the Code Editor’s automatic features on or off by changing the settings in the Options dialog box shown in Figure 1-15. You can also use the Options dialog box to change automatic indentation, code block completion, and other language-specific settings.

Figure 1-23  Error detection in the Code Editor (Image unavailable)

Editing Single-Source Web Forms

ASP.NET also supports single-source Web forms. As the name implies, a single-source Web form has its code and HTML stored in the same single file. Many of the ASP.NET code samples and tutorials posted on the Web use single-source files because they are easier to distribute and display. For example, the following single-source Web form calculates the area of a circle:

Visual Basic .NET

<%@ Page Language="VB" %>
<script runat="server">
    Private Sub butCalculate_Click(ByVal sender As System.Object, _ 
        ByVal e As System.EventArgs)
        ’ Declare variables.
        Dim dblCircArea, dblRadius As Double
        ’ Convert text input to a double (optional).
        If txtRadius.Text <> "" Then _
          dblRadius = System.Convert.ToDouble(txtRadius.Text)
        ’ Calculate area.
        dblCircArea = System.Math.PI * System.Math.Pow(dblRadius, 2)
        ’ Display result.
        ShowResult(dblCircArea)
    End Sub
   
    Sub ShowResult(ByVal Result As Double)
        litResult.Text = "<h3>Results</h3>"
        litResult.Text += "<p>The circle’s area is: <b>" + Result.ToString() _ 
             + "</b>"
    End Sub
</script>
<html>
<head>
    <title>Calculate Area</title>
</head>
<body>
    <form runat="server">
        <h2>Calculate Area
        </h2>
        <hr />
        Circle radius: 
        <asp:TextBox id="txtRadius" Runat="server"></asp:TextBox>
        <asp:Button id="butCalculate" onclick="butCalculate_Click"         Runat="server"
            Text="Calculate"></asp:Button>
        <p>
            <asp:Literal id="litResult" Runat="server"></asp:Literal>
        </p>
    </form>
</body>
</html>

Visual C#

<%@ Page Language="C#" %>
<script runat="server">
    private void butCalculate_Click(object sender, EventArgs e)
    {
        // Declare variables.
        double dblCircArea, dblRadius;
        // Convert text input to a double (optional).
        if (txtRadius.Text != "")
        {
            dblRadius = Convert.ToDouble(txtRadius.Text);
            // Calculate area.
            dblCircArea = 2 * Math.PI * Math.Pow(dblRadius, 2);
            // Display result.
            ShowResult(dblCircArea);
        }
    }
          
    void ShowResult(double Result)
    {
        litResult.Text = "<h3>Results</h3>";
        litResult.Text  += "<p>The circle’s area is: <b>"         + Result.ToString() + 
            "</b>";
    }
</script>
<html>
<head>
<title>Calculate Area</title>
</head>
<body>
    <form runat="server">
        <h2>Calculate Area 
        </h2>
        <hr />
        Circle radius: 
        <asp:TextBox id="txtRadius" Runat="server"></asp:TextBox>
        <asp:Button id="butCalculate" onclick="butCalculate_Click"         Runat="server"
            Text="Calculate"></asp:Button>
        <p>
            <asp:Literal id="litResult" Runat="server"></asp:Literal>
        </p>
    </form>
</body>
</html>

Visual Studio can edit and even run these single-source Web forms; however, the advanced features like autocomplete are not enabled for any of the code entered between the <script> and </script> elements on the page. For this reason, the code samples in this book are shown as code-behind files.

Solution Explorer

Visual Studio .NET organizes applications into projects and solutions. A project is a collection of files that will ultimately make up a single executable. A solution is a group of projects that make up a single functional unit. You view the files in a solution by using the Solution Explorer, as shown in Figure 1-24.

Figure 1-24  The Solution Explorer (Image unavailable)

The project shown in bold is the start-up project. The start-up project is the project that runs when you click Start in Visual Studio .NET. When you’re developing multiple projects as part of a single solution, the start-up project usually calls the other projects in the solution.

Information about a solution is stored in a solution file (.sln), which is placed in your My Documents folder by default. You can open the solution using this file, or you can open projects directly using their project files (.vbproj or .csproj), which are placed in the project folders. If you open a project file, Visual Studio .NET creates a new solution file when you save the project.

Running a Project

You can run a project within Visual Studio .NET by clicking Start on the toolbar, by choosing Start from the Debug menu, or by pressing F5. When you run a project, Visual Studio .NET builds the project files and displays any errors that occur in the Task List window, as shown in Figure 1-25.

Figure 1-25  Running a project with build errors (Image unavailable)

Double-clicking the error description in the Task List selects the line with the error in the Document window so that you can correct the error. The Task List also displays comment tasks you have added to your code, such as 'TODO, //TODO, 'UNDONE, //UNDONE, 'HACK, or //HACK. You can add or modify the tokens you use to identify tasks by configuring the Environment settings in the Options dialog box of Visual Studio.

If no errors occur during the build, Visual Studio .NET starts the application in Debug mode and, in the case of a Web application, starts Internet Explorer and displays the application’s start page. If an error occurs while the application is running in Debug mode, Visual Studio .NET displays the error in the browser, as shown in Figure 1-26.

Figure 1-26  A Web application project with run-time errors (Image unavailable)

You have two choices at this point:

  • If you know what caused the error, you can stop the application by closing the browser window to return to Visual Studio .NET and then correct the error shown.
  • If you are unsure of what caused the error, you can click Back in the browser, switch to Visual Studio .NET to set a breakpoint at a position in the code before the error occurred, and then switch back to the browser to try the task again. Visual Studio .NET will stop the application at the breakpoint you set so that you can step through the code to locate the source of the error.

Once you locate the error, you must stop the application before you can correct it. In earlier versions of Visual Studio .NET, you could correct errors in Debug mode and continue running the application.

Setting Breakpoints and Watching Variables

You can stop a project at a particular line of code by setting a breakpoint. When Visual Studio .NET runs the project, it will stop the project and display the line with the breakpoint in the Code Editor before that line executes, as shown in Figure 1-27.

Figure 1-27  A project stopped at a breakpoint (Image unavailable)

To set a breakpoint, click the gray margin to the left of the line you want to break at, or select the line and press F9. Figure 1-28 shows a breakpoint that has been set.

Figure 1-28  Setting a breakpoint (Image unavailable)

Once Visual Studio .NET stops at a breakpoint, you can view the value of active variables by moving the mouse pointer over the variable. If the variable is a complex type, such as an object or an array, you can view its data by adding it to the Watch window, as shown in Figure 1-29.

Figure 1-29  The Watch window (Image unavailable)

To add an item to the Watch window, select the item and drag it to the Watch window. Click the plus sign (+) next to the item in the Watch window to view subitems, such as array elements or object properties.

Executing Statements

After you have stopped at a breakpoint, you can continue running your application by clicking Continue on the toolbar or by pressing F5. Alternatively, you can execute one line at a time by pressing F10 or F11.

F10 executes each procedure call as a single statement. In other words, F10 steps over a procedure by executing it and stopping at the next line in the current procedure. F11 executes procedure calls by stepping in to the procedure and stopping at the first line in the called procedure. To execute a single line of code outside of the context of the project, type the code in the Command window. Figure 1-30 shows these different techniques.

Figure 1-30  Ways to execute statements (Image unavailable)

The results of statements entered in the Command window are directed to the next line of the command window. For example, the statement ?System.Math.PI displays 3.1415926535897931 on the next line.

Getting Help

Visual Studio .NET includes a combined collection of Help for the programming environment, languages, .NET Framework, technical support, and developer’s network articles. The Help is displayed either within a Document window or outside Visual Studio .NET in a separate window, depending on the preferences you set on the Start Page or in the Options dialog box.

The Help system includes three ways to find topics: the Contents window, the Index window, and the Search window. These windows act like the Tool windows in Visual Studio .NET: they can be "docked" and then hidden or displayed using tabs, as shown in Figure 1-31.

Each of the navigation windows provides a Filter drop-down list that lets you choose a particular programming language or subject to look in. This feature is especially useful in the Search and Index windows because the combined Help collection is large. The Visual Basic And Related filter and the Visual C# And Related filter include most of the topics you need for this book.

Topics that include syntax or code samples have a language filter icon at the top of each page that looks like a funnel. Click the filter icon to change the programming language displayed in the topic or to view all language samples, as shown in Figure 1-32.

Figure 1-31  The Help navigation windows (Image unavailable)

Figure 1-32  Setting the language filter (Image unavailable)

In addition to the Help included with Visual Studio .NET, Microsoft hosts the GotDotNet Web site, at www.gotdotnet.com. That Web site includes tutorials on using ASP.NET and contains links to many other related Web sites.

Summary

  • There are four types of Internet applications: Web applications, Web services, Internet-enabled applications, and peer-to-peer applications.
  • Web applications run on a server, processing user requests for pages and composing those pages using executable code and static resources on the server.
  • Web applications can provide dynamic content based on dynamic server resources, such as a database, and based on user inputs, such as creating a mortgage payoff table from user loan information.
  • ASP.NET is a platform for creating Web applications that run on Windows servers using IIS and the .NET Framework.
  • Web applications are made up of content, an executable, and configuration files.
  • The content of a Web application is presented through Web forms. Web forms use HTML components like conventional HTML pages; like Windows forms, however, they can also respond to user events such as mouse clicks.
  • The Web application’s executable is stored in a .dll file called an assembly. Assemblies are compiled to an intermediate state, and the final compilation is done by the CLR just before running the application.
  • The .NET Framework is made up of the CLR and the .NET class library. The .NET class library makes the CLR run-time tasks available to programmers.
  • The .NET classes are grouped by programming task into namespaces. These groupings help you locate the class, method, or property you need to accomplish a task.
  • Use the Visual Studio .NET Start Page to view current product information, to open new or existing projects, to set user environment preferences, and to sign up for Web hosting services.
  • Edit Web forms and HTML pages visually by using the Document window’s Design mode; edit them as text by using the Document window’s HTML mode.
  • Set the Help language filter to view code samples in a single programming language or in multiple languages.
  • Modify the Visual Studio .NET environment features using the Options dialog box.

Lab: Getting Started with Visual Studio .NET

In this lab, you will familiarize yourself with the Visual Studio .NET programming environment, sign up for Web application hosting, and view the ASP.NET QuickStart Tutorials. These exercises establish a foundation for the specific programming skills you will learn in later chapters.

Estimated lesson time: 30 minutes

Exercise 1: Customize the Visual Studio .NET Environment

In this exercise, you will customize the window display in Visual Studio .NET to maximize the design area. You will also change your Visual Studio .NET settings to display Help in a separate, external window and specify a language filter within Help. When complete, the Visual Studio .NET environment will appear as shown in Figure 1-33.

Figure 1-33  The customized Visual Studio .NET environment (Image unavailable)

When you start Visual Studio .NET for the first time, the default window layout displays the Server Explorer and Toolbox windows as tabs on the left side of the screen and the Solution Explorer and Properties windows on the right side of the screen.

To maximize the screen space for editing Web documents and code

  • From the Window menu, choose Auto Hide All.
  • Or

  • Click Auto Hide in the upper right corner of the Solution Explorer and the Properties windows. The Auto Hide button looks like a pushpin.

When the Auto Hide feature is on, the window disappears when the mouse pointer moves off it. The window reappears when the mouse pointer moves over the window’s tab at the edge of the screen.

Another Visual Studio .NET default setting is to display Help within a Visual Studio .NET Document window. Help itself has quite a few windows, so this window-within-window display can become crowded.

To display Help in its own window

  1. From the Tools menu, choose Options. Visual Studio .NET displays the Options dialog box.
  2. In the Options dialog box, click Help under the Environment folder. Visual Studio .NET displays the Help options, as shown in Figure 1-34.
  3. Figure 1-34  Setting Help options (Image unavailable)

  4. Click the External Help option, and then click OK. Visual Studio displays a message stating that the changes will not take effect until the environment is restarted.

If you experiment with the Visual Studio .NET window layout and don’t like the results, you can restore the default window settings.

To restore the default window settings

  1. From the Tools menu, choose Options. Visual Studio .NET displays the Options dialog box.
  2. In the Options dialog box, under the Environment folder, select General.
  3. Click the Reset Window Layout button. Visual Studio .NET displays a warning asking you to confirm that you want to reset the window layout to the default.
  4. Click OK to clear the warning, and then click OK again to close the Options dialog box. Visual Studio .NET restores the default window layout.

Exercise 2: Set Up a Web Hosting Account

In this exercise, you will set up a Web hosting account that will allow you to deploy Web applications for public testing and evaluation over the Internet. You don’t have to have a Web hosting account to complete the lessons in this book, because you can run and debug Web applications locally on your workstation. However, having a Web hosting account enables you to test how your Web application handles multiple simultaneous users, and it also allows you to share your programming achievements with others, which is just plain fun.

To set up Web hosting

  1. Choose a hosting service provider.
  2. Register with the service.
  3. Sign on to the service and upload your application.
  4. To display the Web Hosting pane in Visual Studio .NET, select the Start Page Document window, click Web Hosting, and then click the Hosting Services tab. The Web Hosting pane appears, as shown in Figure 1-35.
  5. Figure 1-35  ASP.NET Web application hosting services (Image unavailable)

The following sections describe the steps for setting up a Web hosting account in greater detail.

Exercise 3: Choose a Service Provider

The Web Hosting pane lists a number of Web hosting service providers that support ASP.NET Web applications. Each of these providers offers a different combination of free and fee-based services. To evaluate which hosting service is right for you, visit the hosting service Web sites by clicking on their links on the Visual Studio Start Page. In addition to cost, you should consider the following:

  • Level of support Does the hosting service provide a users’ forum or other area where your questions can be answered? If it does, check it out to see what other users are saying.
  • Ability to migrate Will you be able to easily move applications from a testing stage to full deployment? Does the hosting service provide the storage and performance you will need?
  • Database support Most services provide SQL database hosting, but each service charges differently for this feature.

To register with a service provider

  1. In the Web Hosting pane, click the Sign Up With link for the service provider you have chosen. Visual Studio .NET displays the service provider’s registration procedure in a Document window, as shown in Figure 1-36.
  2. Figure 1-36  ProTier Welcome page (Image unavailable)

  3. Follow the service provider’s instructions, which usually involve providing name, address, and e-mail information. When the information is complete, the service provider will e-mail you a user name and password to provide access to your new account.

NOTE:
Register with the service to create your own account. The exact procedure varies for each service provider, but they all follow these basic steps.

The service providers shown in the Web Hosting pane all provide One-Click Hosting, which means that you can upload your completed Web applications directly from the Visual Studio .NET Web Hosting pane.

To upload an application to the hosting service

  1. From the Visual Studio .NET Web Hosting pane, click the Upload Directly To Your Account link for the service provider you signed up for. Visual Studio .NET displays the service’s logon page in a Document window, as shown in Figure 1-37.
  2. Figure 1-37  ProTier logon page (Image unavailable)

  3. On the logon page, enter the user name and password provided for your account. (Usually this is sent to you in e-mail after you sign up for the account.) After you sign on, the service provider displays an upload page in a Document window, as shown in Figure 1-38.
  4. Figure 1-38  ProTier upload page (Image unavailable)

  5. From the list on the left, select the folder containing the application to upload. From the list on the right, select a folder on the server to upload the application to. Click Upload to upload the project to the hosting service.

After you’ve uploaded an application, you and others can view it by navigating to its location on the Internet. The Web hosting service providers don’t require users to sign on to view applications, just to upload them.

Exercise 4: Explore the ASP.NET QuickStart Tutorials

In this exercise, you will install the .NET SDK Samples QuickStart Tutorials and view the QuickStart Tutorials for ASP.NET. The QuickStart Tutorials contain a host of information about the different aspects of the .NET Framework and are one of the best resources for learning how to program using ASP.NET.

To install and view the QuickStart Tutorial for ASP.NET

  1. From the Windows Start menu, point to All Programs, Microsoft .NET Framework SDK, and choose Samples And QuickStart Tutorials. Windows displays the Microsoft .NET Framework SDK QuickStarts, Tutorials And Samples install page, as shown in Figure 1-39.
  2. Figure 1-39  The Microsoft .NET Framework SDK QuickStarts, Tutorials And Samples install page (Image unavailable)

  3. Click the Step 1 Install The .NET Framework Samples Database link to install and configure the SQL database used by the QuickStart samples.
  4. Click the Step 2 Set Up The QuickStarts hyperlink to install and configure the Web sites used by the QuickStart samples.
  5. The next time you access the Microsoft .NET Framework QuickStart Tutorials from the Start menu, Internet Explorer skips the install page and takes you directly to the Microsoft .NET Framework SDK QuickStarts, Tutorials And Samples page, as shown in Figure 1-40.
  6. Figure 1-40  The .NET Framework QuickStart Tutorials page (Image unavailable)

  7. Click the ASP.NET QuickStarts link to view the tutorial page, as shown in Figure 1-41.
  8. Figure 1-41  The ASP.NET QuickStart Tutorials page (Image unavailable)

The ASP.NET QuickStart Tutorials demonstrate how to perform various ASP.NET programming tasks in Visual Basic .NET, Visual C#, and JScript. Most of the samples in the QuickStart Tutorials place server code within script blocks, rather than using code-behind files as is done in this book. In general, it is preferable to use code-behind files because it separates the user interface from the program logic.

Review

The following questions are intended to reinforce key information presented in this chapter. If you are unable to answer a question, review the appropriate lesson and then try the question again. Answers to the questions can be found in the appendix.

  1. Give two examples of how an ASP.NET Web application is different from a traditional Windows application.
  2. What are the two main parts of the .NET Framework?
  3. How do you restore the default window settings in Visual Studio .NET?
  4. Why doesn’t the Visual Studio .NET Code Editor automatically complete the following partial line of code (Visual C# users only)?
  5. int intX = system.math

  6. When can’t you use ASP.NET to create a Web application?
Read More Show Less

Customer Reviews

Be the first to write a review
( 0 )
Rating Distribution

5 Star

(0)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously

    If you find inappropriate content, please report it to Barnes & Noble
    Why is this product inappropriate?
    Comments (optional)