Code Samples


Code Samples

The companion CD inside this book contains the code samples, written in C#, that you'll use as you perform the exercises in the book. By using the code samples, you won't waste time creating files that aren't relevant to the exercise. The files and the step-by-step instructions in the lessons also let you learn by doing, which is an easy and effective way to acquire and remember new skills.

NOTE
If you prefer to use code samples written in Visual Basic, you can download a Visual Basic version of the code samples. See the "Installing the Visual Basic Code Samples" section for more information.

Installing the C# Code Samples

Follow these steps to install the C# code samples on your computer so that you can use them with the exercises in this book.

NOTE
The code sample installer modifies IIS, so you must have Administrator permissions on your computer to install the code samples.

  1. Remove the companion CD from the package inside this book and insert it into your CD-ROM drive.

    NOTE
    An end user license agreement should open automatically. If this agreement does not appear, open My Computer on the desktop or Start menu, double-click the icon for your CD-ROM drive, and then double-click StartCD.exe.

  2. Review the end user license agreement. If you accept the terms, select the accept option and then click Next.

    A menu will appear with options related to the book.

  3. Click Install Code Samples.

  4. Follow the instructions that appear.

    NOTE
    If IIS is not installed and running, a message will appear indicating that the installer cannot connect to IIS. You can choose to ignore the message and install the code sample files, however, the code samples that require IIS will not run properly.

    The code samples will be installed to the following location on your computer: C:\Microsoft Press\ASP.NET 2.0 Step by Step\

    The installer will create a virtual directory named aspnet2sbs under the Default Web Site. Below the aspnet2sbs virtual directory, various Web applications are created. To view these settings, open the Internet Information Services console.

Installing the Visual Basic Code Samples

Follow these steps to download and install the Visual Basic code samples on your computer so that you use them with the exercises in this book.

NOTE
The code sample installer modifies IIS, so you must have Administrator permissions on your computer to install the code samples.

  1. Download the Visual Basic code samples installer from the book's online companion content page: http://www.microsoft.com/mspress/products/mell/

  2. Run the installer.

  3. Follow the instructions that appear.

NOTE
If IIS is not installed and running, a message will appear indicating that the installer can not connect to IIS. You can choose to ignore the message and install the code sample files, however, the code samples that require IIS will not run properly.

The code samples will be installed to the following location on your computer: C:\Microsoft Press\ASP.NET 2.0 Step by Step\

The installer will create a virtual directory named aspnet2sbs under the Default Web Site. Below the aspnet2sbs virtual directory, various Web applications are created. To view these settings, open the Internet Information Services console.

Using the Code Samples

Each chapter in this book explains when and how to use any code samples for that chapter. When it's time to use a code sample, the book will list the instructions for how to open the files. Many chapters begin projects completely from scratch so you can grok the whole development process. Some examples borrow bits of code from previous examples.

Here's a comprehensive list of the code sample projects.

Project

Description

Chapter 1

HelloWorld.asp, Selectnoform.asp, Selectfeature.htm, Selectfeature2.htm, Selectfeature.asp

Several Web resources illustrating different examples of raw HTTP requests.

WebRequestor

A simple application that issues a raw HTTP Request.

Chapter 2

HelloWorld, HelloWorld2, HelloWorld3, HelloWorld4, HelloWorld5, partial1.cs, partial2.cs

Web resources illustrating ASP.NET's compilation models and partial classes.

Chapter 3

BunchOfControls.htm, BunchOfControls.asp, BunchOfControls.aspx

Web resources illustrating rendering control tags.

ControlORama

Visual Studio-based project illustrating Visual Studio and server-side controls.

Chapter 4

ControlORama

Illustrates creating and using rendered server-side controls.

Chapter 5

ControlORama

Illustrates creating and using composite server-side controls and User controls.

Chapter 6

ControlPotpourri

Illustrates control validation, the TreeView, and the MultiView / View controls.

Chapter 7

UseWebParts

Illustrates using Web Parts within a Web application.

Chapter 8

MasterPageSite

Illustrates developing a common look and feel throughout multiple pages within a single Web application using Master Pages, Themes, and Skins.

Chapter 9

ConfigORama

Illustrates configuration within ASP.NET. Shows how to manage the Web.Config file, how to add new configuration elements and how to retrieve those configuration elements.

Chapter 10

SecureSite

Illustrates Forms Authentication and authorization within a Web site.

Login.aspx, OptionalLogin.aspx, Web.Config, Web.ConfigForceAuthentication, Web.ConfigForOptionalLogin

Web resources for illustrating Forms Authentication at the very barest level.

Chapter 11

DataBindORama

Illustrates databinding to several different controls, including the GridView. Also illustrates loading and saving datasets as XML and XML schema.

Chapter 12

MaketPersonal

Illustrates the new ASP.NET 2.0 personalization features.

Chapter 13

SessionState

Illustrates using session state within a Web application.

Chapter 14

UseDataCaching

Illustrates caching data to increase performance.

Chapter 15

OutputCaching

Illustrates caching output to increase performance.

Chapter 16

DebugORama

Illustrates debugging and tracing Web applications.

Chapter 17

UseApplication

Illustrates using the global application object and HTTP modules as a rendezvous point for the application. Illustrates storing globally scoped data and handling application-wide events. Includes an equivalent example module in Visual Basic.

Chapter 18

CustomHandlers

Illustrates custom HTTP handlers, both as separate assemblies and as ASHX files. Includes code in C# and Visual Basic.

Chapter 19

WebServiceORama

Illustrates a Web service that serves up random quotes.

QuoteServiceVB

Illustrates a Web service using Visual Basic that serves up random quotes.

Chapter 20

DeployThis

Illustrates how to make an installation package to deploy a Web site.

All these projects are available as complete solutions for the practice exercises (in case you need any inspiration).

Uninstalling the Code Samples

Follow these steps to remove the code samples from your computer.

  1. In Control Panel, open Add Or Remove Programs.

  2. From the list of Currently Installed Programs, select Microsoft ASP.NET 2.0 Step by Step.

  3. Click Remove.

  4. Follow the instructions that appear to remove the code samples.




Microsoft ASP. NET 2.0 Programming Step by Step
Microsoft ASP.NET 2.0 Step By Step (Step By Step (Microsoft))
ISBN: B002KE5VYO
EAN: N/A
Year: 2005
Pages: 177

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net