Skip to main content

Beginning ASP.NET 1.1 with Visual C# .NET 2003

Beginning ASP.NET 1.1 with Visual C# .NET 2003

Chris Ullman, John Kauffman, Chris Hart, Dave Sussman, Daniel Maharry

ISBN: 978-0-764-57189-3

Mar 2004

888 pages

Select type: E-Book

$25.99

Product not available for purchase

Description

What is this book about?

This hands-on guide teaches you how to build custom ASP.NET Web sites from the ground up. An expert team of authors uses their extensive ASP.NET programming experience to give you hands-on instruction in the best way to create Web sites with ASP.NET and C#. This completely updated edition features new examples, and all code is written and tested for ASP.NET version 1.1.

What does this book cover?

Here are some details on what you'll discover in this book:

  • Fast ASP.NET site construction using Microsoft’s new, free Web Matrix tool
  • How to install and configure ASP.NET
  • Basic programming principles for C#, such as variables, control structures, and procedural programming
  • Techniques for applying these principles as you develop ASP.NET pages
  • The minimum amount of object-oriented programming necessary to work successfully and efficiently with ASP.NET
  • Key differences between ASP.NET 1.0 and 1.1, how to use the examples in this book with either version, and how to move from 1.0 to 1.1
  • Techniques for extending your ASP.NET sites to incorporate related tools and technologies, such as using ADO.NET for data source access, Web Services for inter-site communication, and Server Controls to facilitate code maintenance and reuse
  • How you can make your ASP.NET site production-ready through proper debugging, optimization, and security

Who is this book for?

This book is for beginners who have no previous experience with ASP, C#, XML, object-oriented programming, or the .NET framework. A little knowledge of HTML is useful, but not essential. All the concepts you need to create dynamic ASP.NET Web sites are presented and explained in full.

Introduction.

Chapter 1: Getting Started with ASP.NET.

Chapter 2: Anatomy of an ASP.NET Page.

Chapter 3: Server Controls and Variables.

Chapter 4: Control Structures and Procedural Programming.

Chapter 5: Functions.

Chapter 6: Event-Driven Programming and Postback.

Chapter 7: Objects.

Chapter 8: Reading from Databases.

Chapter 9: Advanced Data Handling.

Chapter 10: ASP.NET Server Controls.

Chapter 11: Users and Applications.

Chapter 12: Reusable Code for ASP.NET.

Chapter 13: .NET Assemblies and Custom Controls.

Chapter 14: Debugging and Error Handling.

Chapter 15: Configuration and Optimization.

Chapter 16: Web Services.

Chapter 17: ASP.NET Security.

Appendix A: Exercise Solutions.

Appendix B: Web Matrix Quick Start.

Appendix C: The Wrox United Database.

Appendix D: Web Application Development Using Visual Studio .NET.

Appendix E: Installing and Configuring IIS.

Index.

Code Downloads
Code downloads for this title are available here.
Download
Code Downloads
Download
Code Downloads
Code downloads for this title are available here.
Code Downloads
Download a SQL Server version of the Wrox United example database.
The complete code download for the book includes an Access version of the Wrox United example database. This separate download is a SQL Server version of the same Wrox United example database.
Download
Replacement for Figure 9-3
Download
Files for chapters 13 exercises referenced on page 507
Download
ChapterPageDetailsDatePrint Run
19MIssing text in file name in Step 1
Step 1 should read: Go to Program Files\Microsoft ASP.NET Web Matrix\v0.6.812 and run Web Matrix. The screen that appears is shown in Figure 1-13:
9/3/04

31Typo in 1st bullet at top of page in url after word or
The url after the word "or" should be: ...or http://localhost/ch02/punctual.aspx....
Not .../ch01/...
9/3/04

72202nd line from bottom of page
Should read: Unlike variables, where the Dim statement defines a class, only the Class keyword followed by the class name (in this case, Person) has been used. The keyword, Public means that the class will be available to all other programs. This is necessary, as an ASP.NET page will use it.
10/14/04

7224First paragraph
Change: This validation checks whether the age is less than zero,
to: This validation checks whether the age is less than one,
10/19/04

7225Last line on page
The New keyword specifies that the object is being created, and therefore causes the constructor to be run. Also, because the property is now read only, the line that explicitly sets the eye color has to be removed:

myPerson.EyeColor = "Blue"
10/14/04

72282nd line of step 4
Should be: You'll see a simple display that shows the name of the person and the direction they are traveling in, as shown in Figure 7-4:
10/14/04

72292nd & 3rd lines of last text paragraph
Should be: A value greater than 0 is taken as traveling forwards, and a negative number as traveling backwards:
10/14/04

82512nd bullet in bulleted list
Should be: Speed: Stored procedures are optimized the first time they are called, and then the optimized code is used in subsequent calls.
10/14/04

82541st line of code in code block
Should be: <wmx:AccessDataSourceControl id="AccessDataSourceControl1"
10/14/04

82551st two lines of code in code block
Should be: <wmx:MxDataGrid id="MxDataGrid1" runat="server"
DataSourceControlID="AccessDataSourceControl1" BorderColor="#CCCCCC"
10/14/04

82561st two lines of code in code block
Should be: <wmx:MxDataGrid id="MxDataGrid1" runat="server" DataSourceControlID="AccessDataSourceControl1">
10/14/04

257Code block after step 3, 5th line of code
Change: "Data Source=C:\BegASPNet11\data\Northwind.mdb";
to: @"Data Source=C:\BegASPNet11\data\Northwind.mdb";
10/19/04

260Last code block, 2nd line
Change: "Data Source=C:\BegASPNet11\data\Northwind.mdb";
to: @"Data Source=C:\BegASPNet11\data\Northwind.mdb";
10/19/04

82621st sentence in step 3
Should be: Pick the SELECT Data Method and drag it from the Toolbox, dropping it into your code window (make sure that where you drop the toolbox item is outside any existing procedures):
10/14/04

82722nd table, 1st description for method "ExecuteNonQuery"
Should be: This executes the command but doesn't return any rows of data. It is useful for commands that perform an action, such as updating data, but that don't need to return a set of data. A value is returned, indicating the number of rows affected by the command.
10/14/04

82781st paragraph, 2nd sentence after "The DataReader Object" heading
The DataReader, an object that we haven't come across yet, is optimized for reading data.
10/14/04

92843rd to last line & last line in code block
3rd to last line should be: dataAdapter.Fill(data)

Last line should be: dataAdapter.Fill(data)
10/14/04

92851st code block
1st code block should be:
dataAdapter.Fill(data, "Products")
dataAdapter.SelectCommand.CommandText = "SELECT * FROM Employees"
dataAdapter.Fill(data, "Employees")

10/14/04

9285The following addition goes after the first code block on this page
The problem is that this code doesn't work as expected, because IDbDataAdapter doesn't accept the table name as an argument. For this to work you have to use the actual class, OleDbDataAdapter, rather than the interface:
System.Data.OleDbOleDbDataAdapter dataAdapter =
new System.Data.OleDbOleDbDataAdapter();
dataAdapter.SelectCommand = dbCommand;
System.Data.DataSet data = new System.Data.DataSet();
dataAdapter.Fill(data, "Products");
10/15/04

9287Step 4, 2nd sentence
Should be: Also drag two the Label controls onto the page and position them as headings to show the contents of selected items from the Datagrid controls.
10/14/04

9287Error in Figure 9-3
Replacement Figure 9-3 can be downloaded on the download page.
10/14/04

9295Addition to end of last paragraph & replacement for final code block as follows:
Finally we update the data for the selected row. There could be many rows returned by the Select() method, so we index into the array. In our case we know that there is only one row returned – at most one row. We check the Length of the SelectedRows array to make sure that at least one row was found, as trying to update the row would fail if nothing was found.:
// Find the row to change
selectedRows = table.Select("FirstName='Margaret' AND LastName='Peacock'");
if (selectedRows.Length > 0)
{
selectedRows(0).Item("FirstName") = "John";
selectedRows(0).Item("LastName") = "Hartford";
}

// bind the data grid to the new data
DataGrid3.DataSource = table;
DataGrid3.DataBind();
10/15/04

14515Step 1, 1st line
Should be: Open Web Matrix and create a new file called syntaxerror.aspx and type the following lines of code into the All Window.
9/17/04

14515Step 2, first line
Should be Save this file and load the file using a browser. (Delete "as syntaxerror.aspx")
9/17/04

155633rd full paragraph, 4th line
"...find Webserver.exe.config that..." should be "...find WebServer.exe.config that..."
9/17/04

155682nd code block
Last part of code should be:
userControlBaseType="[typename]"//Default: System.Web.UI.UserControl
validateRequest="[true|false]"       // Default: true
-->
<pages buffer="true" enableSessionState="true" enableViewState="true"
  enableViewStateMac="true" autoEventWireup="true" validateRequest="true"
/>
9/17/04

15569Code block under heading "web.config File"
Should be:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
   <compilation />
   <customErrors />
   <authentication />
   <authorization />
   <trace />
   <sessionState />
   <globalization />
  </system.web>
</configuration>
9/17/04

155763rd full bullet on the page
Should be:
VaryByHeader enables you to cache pages specified by different HTTP headers, using a semicolon-separated list of strings.
Delete the 2nd sentence.
9/17/04

155764th full bullet on the page
Replace current bullet with:
VaryByParam enables you to cache sections of the page according to a list of parameters, which are also supplied as a semi-colon delimited list of strings. These strings will either be a query string , or a parameter sent via the POST() method. The permissible values include none,*, or any valid query string or POST() parameter name. You must include this attribute whenever you output cache an ASP.NET page or user control, because a parser error will result otherwise. To ensure the entire page is cached, just set the value to none. The "*" (asterisk) setting specifies that the Output Cache should hold a version of the page for every parameter property that your control returns.
9/17/04

15581Code line before 2nd bulleted list
Should be:
Cache.Insert (FileName, Object, Dependency, DateTime, TimeSpan)
9/17/04

155812nd bullet in 2nd bulleted list
Should be:
Object: Name of the object, most typically a DataSet.
9/17/04

15585Error in 5th (next to last) code block
First line should be:
grid1.DataSource = nothing
9/17/04

155865th text paragraph, last line
("address") should be ("addressKey")
9/17/04

15589Last code block under heading "Cache Priorities"
2nd line should be:
TimeSpan.Zero, CacheItemPriority.High )
9/17/04

Appendix A7131st line of Excercise 2 Solution
Should read: The following setion should go in web.config in the ch15 folder.
9/24/04

Appendix A714Last line of 1st code block in Exercise 3 Solution
Should read:<12:mylabel12 text="ServerTime()" runat="server"/>
9/24/04

717Error in code block
Source=C:\\BegASPNET\\ch16\\Northwind.mdb;"
Should be
Source=C:\\BegASPNET11\\ch16\\Northwind.mdb;"
9/24/04

722Error in code block
+ "'" + "ZipCode = '" + txtZipCode.Text + "'";
Should be:
+ "'" + "AND ZipCode = '" + txtZipCode.Text + "'";
9/24/04

Appendix A72129th line of code
Should be: <br />Zip:|<br />
9/24/04

What is this book about?

This hands-on guide teaches you how to build custom ASP.NET Web sites from the ground up. An expert team of authors uses their extensive ASP.NET programming experience to give you hands-on instruction in the best way to create Web sites with ASP.NET and C#. This completely updated edition features new examples, and all code is written and tested for ASP.NET version 1.1.

What does this book cover?

  • Fast ASP.NET site construction using Microsoft’s new, free Web Matrix tool
  • How to install and configure ASP.NET
  • Basic programming principles for C#, such as variables, control structures, and procedural programming
  • Techniques for applying these principles as you develop ASP.NET pages
  • The minimum amount of object-oriented programming necessary to work successfully and efficiently with ASP.NET
  • Key differences between ASP.NET 1.0 and 1.1, how to use the examples in this book with either version, and how to move from 1.0 to 1.1
  • Techniques for extending your ASP.NET sites to incorporate related tools and technologies, such as using ADO.NET for data source access, Web Services for inter-site communication, and Server Controls to facilitate code maintenance and reuse
  • How you can make your ASP.NET site production-ready through proper debugging, optimization, and security

Who is this book for?

This book is for students who have no previous experience with ASP, C#, XML, object-oriented programming, or the .NET framework. A little knowledge of HTML is useful, but not essential. All the concepts you need to create dynamic ASP.NET Web sites are presented and explained in full.