Topic: ASP.NET

Beginning ASP.NET 1.1 with VB.NET 2003 (0764557076) cover image

Beginning ASP.NET 1.1 with VB.NET 2003

Chris Ullman, John Kauffman, Chris Hart, David Sussman
ISBN: 978-0-7645-5707-1
Paperback
888 pages
January 2004
This title is out-of-print and not currently available for purchase from this site.

Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
1 23 Missing "to" in sentence
Step 3 should read: "The installation process will continue without requiring further intervention, although you may have to reboot the system afterwards. Once MDAC is installed, you are ready to install ASP.NET.
9/3/04
1 29 Additional configuration directions

The configuration directions as written cause Web Matrix to use Framework version 1.1, but you also need to configure the Web server Cassini to use Framework version 1.1 or you could have problems when you use a DLL created in WebMatrix version 1.1 but try to run a Web form against the server using Framework 1.0. Specifically, without this fix you might encounter this problem in chapter 16. To correct this, replace step 4 on page 29 with these new steps 4 to 6.

4. Save the file.

5. Next you need to create a new text file with the name WebServer.exe.config and add the following code:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v1.1.4322" />
</startup>
</configuration>

If the file already exists then all you need do is insert the <startup> and <supportedRuntime> tags between the <configSection> and <runtime> tags as you did with WebMatrix.exe.config.

6. Save the file and when you run Web Matrix, the .NET Framework version should now be 1.1.x. Select the "About ASP.NET Web Matrix..." item from the Help menu. It should confirm this.

12/11/03 1
1 29 Missing 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
1 36 Typo in Step 1 New Files should be New File
The second sentence should read: Then select New File from the File menu and in the dialog change the Location and Filename details as shown in Figure 1-23:
9/3/04
1 42 Typo in 2nd bullet in url after word or
The url after the word "or" should be: ...or http://localhost/ch02/punctual.aspx....
Not .../ch01/...
9/3/04
2 61 Missing GrocerToGo.mdb file
The GrocerToGo.mdb file is not part of the book, but part of the .NET Framework examples AFAIK.
Search Google for grocertogo.mdb and Download, and I think you should be able to find it. You may even have it already somewhere on your system....
2/19/04
7 219 Last paragraph, 2nd sentence
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
7 225 1st line in step 4
From the Page_Load method, take out the line that sets the EyeColor and modify the class constructor so it looks like the following:
10/14/04
7 225 4th paragraph under "How It Works"
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
7 227 4th line on page
A method is simply a Public Function or Public Sub within the class, and follows the same rules for those as discussed in Chapter 5 so we don't need to cover the basics again.
10/14/04
7 227 1st line in step 1
Edit the FirstClass.aspx file, and remove the text and labels from the HTML <form runat="server"> section.
10/14/04
7 228 2nd line in 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
7 230 1st text paragraph, 2nd sentence
Should be: A value greater than 0 is taken as traveling forwards, and a negative number as traveling backwards:
10/14/04
8 253 2nd 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
8 257 1st line of code
Should be: <wmx:AccessDataSourceControl id="AccessDataSourceControl1"
10/14/04
8 258 1st two lines of code in code block
Should be: <wmx:MxDataGrid id="MxDataGrid1" runat="server"
DataSourceControlID="AccessDataSourceControl1" BorderColor="#CCCCCC"
10/14/04
8 259 1st two lines of code in code block
Should be: <wmx:MxDataGrid id="MxDataGrid1" runat="server" DataSourceControlID="AccessDataSourceControl1">
10/14/04
8 266 1st 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
8 270 2nd sentence under "How It Works"
This is great if you are a newcomer to SQL as you don't have to understand how the SQL language works.
10/14/04
8 273 5th text paragraph, 3rd sentence
Should be: This is on the first screen and is the same as the Data Explorer allowing you to pick either Access or SQL Server database.
10/14/04
8 277 2nd table, 1st description for metod "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
8 280 1st paragraph after figure 8-22, 2nd sentence
First you've used two controls that are bound to data the list of categories and the grid of products.
10/14/04
8 283 1st paragraph, 1st sentence under "The DataReader Object" heading
The DataReader, an object that we haven't come across yet, is optimized for reading data.
10/14/04
9 288 3rd 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
9 289 2nd code block & addtional text and code block

2nd code block should be:

dataAdapter.Fill(data, "Products")
dataAdapter.SelectCommand.CommandText = "SELECT * FROM Employees"
dataAdapter.Fill(data, "Employees")

Additional paragraph and code block after 2nd code block should be:

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:

Dim dataAdapter As System.Data.OleDb.OleDbDataAdapter = _
   New System.Data.OleDb.OleDbDataAdapter
dataAdapter.SelectCommand = dbCommand
Dim data As System.Data.DataSet = New System.Data.DataSet
dataAdapter.Fill(data, "Products")

10/14/04
9 291 Step 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
9 292 Error in Figure 9-3
Replacement Figure 9-3 can be downloaded on the download page.
10/14/04
9 299 3rd code block, 1st line
Should be: DataGrid2.DataSource  =  table
10/14/04
9 300 2nd paragraph & 1st code block
Should be:
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 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.:
If SelectedRows.Length > 0 Then
   selectedRows(0).Item("FirstName") = "John"
   selectedRows(0).Item("LastName") = "Hartford"
End If
10/14/04
9 300 6th code block, 1st line
Should be: DataGrid3.DataSource = table
10/14/04
9 301 1st code block, 1st line
Should be: DataGrid4.DataSource = table
10/14/04
9 302 Additional line to code block
1st line should be: <%@ Page Language="VB" %>
10/14/04
9 310 Add to beginning of code block
If txtFirstName.Text.Trim() = "" Or _
   txtLastName.Text.Trim() = "" Then
   Return
End If
10/14/04
9 312 2nd code block
Should be:
Dim commandString As String = _
   "INSERT INTO Employees(FirstName, LastName) " & _
   "Values(@FirstName, @LastName)"
10/14/04
9 312 4th code block, 5th line
Should be: lastNameParam.Value = txtLastName.Text
10/14/04
9 312 5th code block
Should be:
If dbCommand.ExecuteNonQuery() > 0 Then
  lblStatus.Text = "Data was added successfully"
Else
  lblStatus.Text = "Data could not be added"
End If
10/14/04
13 476 Tutorial referenced is missing
Can be found on the download page
12/1/04
13 511 Replacement exercises for 1-4
Replace exercises 1-4 completely with exercises 1-5 in the file 57076_ch13_Exercises.doc on the download page.
9/17/04
14 516 Last 2 lines
DepostAmount should not be broken
9/17/04
14 517 Corrections in Table
Cbool should be CBool
Cbyte should be CByte
Cchar should be CChar
Cdate should be CDate
Cdec should be CDec
Cint should be CInt
Cobj should be CObj
9/17/04
14 517 1st line of code in the code following the table at the bottom of the page
Condtion should be Condition
9/17/04
14 520 Step 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
14 520 Step 2, first line
Should be Save this file and load the file using a browser. (Delete "as syntaxerror.aspx")
9/17/04
14 524 4th line of code block in step 1
Should be:
Else If CInt (txtQuantity.Text) <= 0 Then
9/17/04
14 532 1st line, last paragraph on the page
Should be:
Setting the Debug mode at the application level will display...
9/17/04
14 539 2nd line in 2nd paragraph under Application-Level Tracing heading
2nd sentence should be:
For instance, if tracing is enabled at the application level but disabled for a page,...
9/17/04
14 539 Error in 3rd line in 2nd code block
Should be:
<trace enabled="true" requestLimit="10" pageOutput="false"
9/17/04
14 541 Step 1, 1st sentence on 2nd line in text
1st sentence should be:
Open Web Matrix, create a new file called unstructurederror.aspx, and then replace the existing code in the Code Window with the following:
9/17/04
14 543 Try It Out heading
Heading should be:
Try It Out Using On Error Goto
9/17/04
14 544 2nd & 3rd paragraphs
In the 2nd paragraph, in the 2nd sentence, and the 3rd paragraph, in the 1st & 2nd sentences, On Error should be On Error Goto.
9/17/04
14 557 Error in Figure 14-23
Replacement Figure 14-23 can be downloaded on the download page.
9/17/04
14 558 Error in Figure 14-24
Replacement Figure 14-24 can be downloaded on the download page.
9/17/04
14 558 Error in 1st code block, 1st line
Code should read <customErrors defaultRedirect="userError.aspx" mode="On">
9/17/04
15 570 2nd line
Delete "Special Edition"
9/17/04
15 571 5th paragraph, 4th line
"...find Webserver.exe.config that..." should be ""...find WebServer.exe.config that..."
9/17/04
15 576 Last code block missing code
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
15 576 Last paragraph, 1st sentence
Sentenced should be:This should give you a reasonable idea as to how each of the settings work, and how they may be specified.
9/17/04
15 577 Error in code block at bottom of page
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
15 578 Last line, bottom of page
Delete "Special Edition"
9/17/04
15 579 1st character in each of the last 3 bullets in bullet list & 4th line of 3rd bullet
Should not be capitalized. Should be: enableSessionState, enableViewState, enableViewState, and autoEventWireup respectfully.
9/17/04
15 584 Last bulltet on 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
15 590 Code line before 2nd bulleted list
Should be:
Cache.Insert (FileName, Object, Dependency, DateTime, TimeSpan)
9/17/04
15 585 1st bullet on 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
15 590 2nd bullet in 2nd bulleted list
Should be:
Object specifies the name of the object, most typically a DataSet.
9/17/04
15 593 1st line of code after step 4
Should be:
<?xml version="1.0"?>
9/17/04
15 594 Error in 5th (next to last) code block
First line should be:
grid1.DataSource = nothing
9/17/04
15 595 5th text paragraph, 3rd line
("address") should be ("addressKey")
9/17/04
15 596 First character in the 6th line of the code block
MyLabel1.Text="Cache Full" should be myLabel1.Text="Cache Full"
9/17/04
15 595 6th text paragraph
Let's transperse this code into a fully working example.
Should be:
Let's integrate this code into a fully working example.
9/17/04
15 598 1st character in the 2nd line of the 3rd code block
MyLabel1.Text="Cache Full" should be myLabel1.Text="Cache Full"
9/17/04
15 599 Code block under heading "Cache Priorities"
2nd line should be:
TimeSpan.Zero, CacheItemPriority.High )
9/17/04
16 608 3rd Code block, 2nd and 3rd lines
Should be:
< WebMethod (Description:="Returns a greeting using the name passed in")> _
Public Funtion Hello(ByVal Name As String) As String
9/27/04
16 610-611 Paragraph below HTTP Post heading
Should read:
HTTP POST
By default though when you send a web service, you will be using HTTP POST, which uses the body of the Request to carry the name-value pairs. You can retrieve these values using the Request.Form collection in ASP.NET. If you use the POST method to send the information, it means that the information isn't visible in the URL. This provides a slightly more secure method, since it is possible to manipulate the name-value pairs when using the GET method, by just typing names and values into the query string in the address bar.
9/27/04
16 624 2nd code block, 2nd line
LibraryConn should start a new line.
9/27/04
16 625 1st paragraph, 2nd and 3rd lines
BookDetails should be BookDetail
9/27/04
16 634 Replacement Figure 16-17
Replacement Figure 16-17 can be downloaded on the download page.
9/28/04
16 643 Code block at top, last line of step 1
0 should not be there.
9/27/04
17 669 4th text paragraph, 3rd and 4th lines
3rd line: "C:\BegASPNET11\" should be "C:\BegASPNET11\Ch17\" 4th line: "C:\BegASPNET11\admin" should be "C:\BegASPNET11\Ch17\admin"
9/27/04
17 671 1st line in step 1
"the" is duplicated
9/27/04
17 671 Code block following Step 1
Additional code lines between <configuration> & <system.web>

<appSettings>
                    <add key="ConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;
Ole DB Services=-4; Data
Source=C:\BegASPNET11\ch17\WroxUnited\Database\WroxUnited.mdb"/>
       </appSettings>

        <system.web>
9/27/04
17 672 Step 4 text
Should read: Add the following code in the Web Matrix Code window (this is where the code behind goes):
9/27/04
17 672 Step 4 Code block, 2nd code line
Should be:
Dim PlayersDB as System.Data.IDataReader
9/27/04
17 673 1st code block, 1st line
Should be:
System.Data.OleDb.OleDbConnection(connectionString)
9/27/04
17 673 1st code block, 15th line
Should be:
[Players].[SitePassword],[Players].[AdminLevel] FROM [Players]"
9/27/04
17 673 1st code block, 3rd line from bottom of block
Should be:
dbCommand.ExecuteReader( System.Data.CommandBehavior.CloseConnection )
9/27/04
17 677 2nd line in Step 11
Should read: "You're redirected back to the default.aspx page."
9/27/04
17 679 5th text paragraph, 1st line
Should read: "During this subprocedure, we call the IDataReader function."
9/27/04
17 680 2nd code block, 1st line
Should read: "lblStatus.Text = "<br>You are logged in as: " & Request.Cookies ("User NameCookie").Value"
9/27/04
17 680 Last text line
Should read: "Then as we no longer want the user to be logged in, we dump them unceremoniously back at the default.aspx page:"
9/27/04
17 682 Code block with step 1
Should be:
<configuration>
<appSettings>
             <add key="ConnectionString" value="Provider=Microsoft.Jet.OLEDB.4.0;
Ole DB Services=-4; Data
Source=C:\BegASPNET11\ch17\WroxUnited\Database\WroxUnited.mdb"/>
</appSettings>
    <system.web>
     <authentication mode="Forms">
       <forms name=".WroxDemo2" loginUrl="login.aspx"
       protection="All" timeout="20"
      requireSSL="true" />
     </authentication>
     <authorization>
       <deny users="?" />
     </authorization>
   </system.web>
</configuration>
9/27/04
Appendix A 736 1st line of Excercise 2 Solution
Should read: The following setion should go in web.config in the ch15 folder.
9/24/04
Appendix A 736 Last Line of 1st code block in Exercise 3 Solution
Should read:<12:mylabel12 text="ServerTime()" runat="server"/>
9/24/04
Appendix A 738 1st line of code block in Exercise 4 Solution
Should be: <%@ WebService Language="VB" Class="Circles"%>
9/24/04
Appendix A 739 Mid way through Exercise 5 code block Solution
Should be:
NET11\ch16\Northwind.mbd;"
9/24/04
Appendix A 743 Exercise 2 Solution 2nd code block, 14th code line
Should be: <br />Zip:|<br />
9/24/04
Appendix A 743 Exercise 3 Solution code block, 4th line from bottom of page
Should be: txtEmail.Text & "'" & "AND ZipCode = '" & txtZipCode.Text & "'"
9/24/04