Lab Working With Site Navigation

In this lab, you create a Web application using frames. The top frame contains a title for your Web application and a SiteMapPath control. The left frame contains a Tree-View control for navigation. Clicking any node on the TreeView or SiteMapPath controls cause the main frame to load the desired page. Exercise 1 Create the Web Application Project and Its Frames In this exercise, you create the Web application project. You also configure Default.aspx to be a frames page and add the top and left...

Monitoring Performance Counters

Once you create performance counter objects, you must provide data for these counters to be useful. First, you must add a PerformanceCounter object to your application. When developing a Windows Forms application, you can add a Performance-Counter object to a form using the Designer. However, when developing an ASP.NET Web form, you must add the PerformanceCounter object programmatically. The following code sample reads the ASP.NET Requests Queued performance counter and displays the value in...

Info Ext

Type Element Name GrandChild Attr Figure 4-20 Parsing the XmlDocument. Parsing XmlDocuments Using the XPathNavigator The XPathNavigator provides an alternate method of walking the XML document recursively. This object does not use the methods that are defined in the DOM. Instead, it uses XPath queries to navigate the data and is in the System.Xml.XPath namespace. It offers many methods and properties that can be used, as shown in the following code example Protected Sub Button3_C1ick ByVa1...

Lesson Review Quq

You can use the following questions to test your knowledge of the information in Lesson 1, Configuring Globalization. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. You need to create a Web page that is available in both the default language of English and in German. Which of the following...

Lesson Review Tsh

You can use the following questions to test your knowledge of the information in Lesson 2, Using Themes and User Profiles. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. Which of the following themes can override an attribute that you specified for a control Choose all that apply. A. A theme...

Lesson Review Ked

You can use the following questions to test your knowledge of the information in Lesson 3. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. Which of the following can be a Web Part Choose all that apply. A. A custom control based on the Web User Control template 2. Which of the following are...

Lesson Review Mib

You can use the following questions to test your knowledge of the information in Lesson 1, Using Master Pages. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. What is the relationship between master and content pages Choose the best answer. A. One master page for multiple content pages B. One...

Lesson Review Vnn

You can use the following questions to test your knowledge of the information in Lesson 1, Deploying Web Applications. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. You need to add a registry entry to make your application function. In which phase of the Web Setup Project should you add the...

Lab Working with Connected Data

In this lab, you will work with the Visual Studio 2005 GUI to create a Web page that displays the shippers in the Northwind database and supports inserts, updates, and deletes. Exercise 1 Create the Web Site and the Typed DataSet In this exercise, you will create the Web site and add the controls to the site. 1. Open Visual Studio 2005 and create a new Web site called WorkingWithCon-nectedData using your preferred programming language. The new Web site will be created and a Web page called...

Navigating DataTable Objects with DataRelation Objects

The DataRelation object is used to join two DataTable objects that are in the same DataSet, thus providing a navigable path between the two DataTable objects. The DataRelation can be traversed from parent DataTable to child DataTable or from child DataTable to parent DataTable. The following code example populates the Company and Employee DataTable objects and then performs DataRelation object navigation Protected Sub Button2_Click ByVal sender As Object, _ ByVal e As System.EventArgs Handles...

OpenWave

One of the common cell phone emulator providers is OpenWave you can download the latest phone emulators from http developer.openwave.com. Figure 12-1 shows the generic phone emulator. In addition, OpenWave also provides skins for many popular phones. Figure 12-1 The OpenWave generic phone emulator. When the generic phone is displayed, the Simulator Console window is also displayed, as shown in Figure 12-2. The Simulator Console window displays the raw Hypertext Transfer Protocol HTTP and header...

Configuring Deployment Properties

Many Web applications do not require custom configuration. More complex Web applications might have complex dependencies such as particular operating system versions or service packs , require custom registry entries, or need administrator configuration. You can use Web Setup Projects to deploy Web applications to meet any of these requirements. The sections that follow discuss how to do this in more detail. Configuring Launch Conditions You can specify launch conditions to restrict the...

Adding an MasterType Declaration in a Content Page

Before you can reference master properties in a content page, you must add the MasterType declaration to the .aspx content page below the Page declaration, as the following demonstrates lt Page Language VB CodeFi1e Home.aspx.vb Inherits Home Tit1e Contoso Home Page gt lt MasterType gt lt Page Language C CodeFi1e Home.aspx.cs Inherits Home Tit1e Contoso Home Page gt lt MasterType gt You are now ready to reference master properties. However, the Visual Studio 2005 development environment might...

Info Pvx

3. In Design view, double-click the ImageMap to create the ImageMap1_Click event handler in the code-behind page. Add code to this method that places the Post-BackValue into Label2. Also add code that changes the ImageUrl of the ImageMap to display the current room that has been selected. 4. In Design view, double-click the Wizard to add the Wizard1_FinishButtonClick event handler in the code-behind page. In this method, add code to hide the Wizard and display a thank-you message. 5. In Design...

Info Mbq

Figure 3-36 The AdRotator control hierarchy. The advertisement information can be retrieved from an XML file or from a database. Table 3-5 describes the elements that can be placed in the XML file for each advertisement. The category key of the ad. This can be used to filter for specific ads. The URL of the advertisement image to display. The URL to navigate to when the ad is clicked. The text to display if the image is unavailable is displayed as a ToolTip. A number that is used to weight the...

Using the DbDataReader Object

A DbDataReader object provides a high-performance method of retrieving data from the data store. It delivers a forward-only, read-only, server-side cursor. This makes the DbDataReader object an ideal choice for populating ListBox controls, DropDownList controls, and even GridView controls that display read-only data. When you run reports, you can use the DbDataReader object to retrieve the data from the data store. The DbDataReader might not be a good choice when you are coding an operation...

Lesson Review Ydm

You can use the following questions to test your knowledge of the information in Lesson 2, Using the ADO.NET Connected Classes. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. Which of the following ways can you proactively clean up a database connection's resources Choose two. A. Execute the...

Lesson Review Njk

You can use the following questions to test your knowledge of the information in Lesson 1, Using the ADO.NET Disconnected Classes. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. You have a DataSet containing a Customer DataTable and an Order DataTable. You want to easily navigate from an Order...

Using the DbDataAdapter Object

The DbDataAdapter object is used to retrieve and update data between a DataTable and a data store. The DbDataAdapter is derived from the DataAdapter class and is the base class of the provider-specific DbDataAdapter classes, as shown in Figure 4-14. Figure 4-14 The DbDataAdapter hierarchy, showing the DataAdapter base class and the provider-specific derived classes Figure 4-14 The DbDataAdapter hierarchy, showing the DataAdapter base class and the provider-specific derived classes The...

ASPNET Web Events

ASP.NET includes many different types of events that can be sent through any of the event providers. These events are listed in Table 13-6. Represents a significant event in the lifetime of an ASP.NET application. Application lifetime events include events such as application startup and shutdown events. If an application is terminated, you can determine why by viewing the related eventmessage field. Serves as the base class for all ASP.NET health-monitoring audit events. Provides information...

The Literal Control

The Literal control is similar to the Label control, as both controls are used to display static text on the Web page. The Literal control does not inherit from WebControl, as shown in the Literal control's object model in Figure 3-1. The Literal control does not provide substantial functionality and does not add any HTML elements to the Web page where the Label is rendered as a lt span gt tag. This means that the Literal does not have a Style property, and you cannot apply any styles,...

Introducing DataBound Controls

Data-bound controls are controls that need to bind, or connect, to data. The data-bound controls are classified as simple, composite, or hierarchical controls. Simple data-bound controls are the controls that inherit from the ListControl and the AdRotator controls. Composite data-bound controls are classes that inherit from Composite-DataBoundControl, such as the GridView, DetailsView, and FormsView controls. Hierarchical data-bound controls are the Menu and TreeView controls. The .NET...

Response

The Page.Response property is an HttpResponse object that allows you to add data to the HTTP response being sent back to the client who requested a Web page. The Response object includes several useful methods BinaryWrite Writes binary characters to the HTTP response. To write a text string instead, call Write. AppendHeader Adds an HTTP header to the response stream. You only need to use this if you need to provide a special directive to the Web browser that IIS does not add. Clear Removes...

Performing Bulk Copy Operations with the SqlBulkCopy Object

The SqlBulkCopy class provides a high-performance method for copying data to a table in a SQL Server database. The source of the copy is constrained to the overloads of the WriteToServer method, which can accept an array of DataRow objects, an object that implements the IDbDataReader interface, a DataTable object, or a DataTable and DataRowState, as shown in Figure 4-13. This variety of parameters means that you can retrieve data from most locations.

Creating a Templated User Control

A templated user control provides separation of control data from its presentation, meaning that a templated user control does not provide a default user interface. For example, if you know that you need to display your shipper's information, such as the shipper ID, the shipper name, and the shipper phone number, but you don't know how the page designer wants to format this information, you could create a templated user control called ShipperControl that allows the page designer to supply the...

Lesson Review Ajy

You can use the following questions to test your knowledge of the information in Lesson 1, Building Mobile Applications. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. You attempt to create a mobile Web site, but don't see a mobile Web site project template, so you create a standard Web site....

Dbq

Typically, the physical path to a data source. Working with Sample ODBC Connection Strings The following connection string instructs the text driver to treat the files that are located in the C Sample MySample-Folder subdirectory as tables in a database. Driver Microsoft Text Driver .txt .csv DBQ C Samp1e MySamp1eFo1der The following connection string instructs the Access driver to open the Northwind database file that is located in the C Program Files mySampleFolder folder. Driver Microsoft...

SignOut Removes the authentication ticket essentially logging the user off

When using forms authentication, you must include two sections at a minimum A forms authentication page A method for users to log off and close their current sessions To create a forms authentication page, create an ASP.NET Web form to prompt the user for credentials and call members of the System.Web.Security.FormsAuthentication class to authenticate the user and redirect him or her to a protected page. The following code sample demonstrates an overly simple authentication mechanism that just...

Lesson Summary Ewh

You can catch unhandled exceptions at the page level by responding to Page_Error, or at the application level by responding to Application_Error. In either event handler, you read the last error by calling Server.GetLastError. Then, you must remove it from the queue by calling Server.ClearError. You can use a System.Configuration.Configuration to examine and update configuration settings. To create a Configuration object, call WebConfigurationManager.Get-Section and cast the returned object to...

Exercise 1 Create a Web Setup Project

In this exercise, you create a new ASP.NET Web site and a Web Setup Project. 1. In Visual Studio 2005, create a new Web site. 2. In Visual Studio, select the File menu, select Add, and then select New Project. 3. Under Project Types, expand Other Project Types, and then select Setup And Deployment. Under Templates, click Web Setup Project. In the Name field, type MyWebSetup. Then click OK. 4. Visual Studio adds the project to your Web site and displays the File System editor. Right-click Web...

Working with Naming Containers and Child Controls

A Web page is made up of a hierarchy of controls. The System.Web.UI.Control class, which is the class that the Web page and its controls inherit from, has a Controls collection property. This means that the Web page has a Controls collection, each of the controls in that collection has its own Controls collection, and so on. The Web page is a naming container for the controls that are added to it. A naming container defines a unique namespace for control names. Within a naming container, every...

Lesson Review Xfw

You can use the following questions to test your knowledge of the information in Lesson 3, Using Caching to Improve Performance. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. You are creating an ASP.NET Web page that displays a list of customers generated by a database query. The user can...

Lesson Review Oyn

You can use the following questions to test your knowledge of the information in Lesson 1, Using ASP.NET Membership. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. Which of the following controls provides a link for unauthenticated users to log on Choose the best answer. 2. You use the ASP.NET...

Lesson Review Lrd

You can use the following questions to test your knowledge of the information in Lesson 2, Working with Custom Web Server Controls. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. Which of the following attributes can be used to set the image that is displayed in the Toolbox for your custom Web...

Lesson Review Jwj

You can use the following questions to test your knowledge of the information in Lesson 1, Working with User Controls. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. What file extension do you use to create a user control Choose one. 2. You want to create a user control to display data, but...

The Image Control

The Image control is used to display an image on a Web page. This control generates an lt img gt element when rendering to HTML. The Image control inherits directly from the Web control class, and the ImageMap and ImageButton inherit from the Image control, as shown in Figure 3-5. Figure 3-5 The Image control hierarchy. Figure 3-5 The Image control hierarchy. The Image control's primary property, ImageUrl, indicates the path to the image that is downloaded from the browser and displayed. This...

Lab Store State Management Data on the Client

In this lab, you use different client-side state management techniques to track the number of pages a user opens. Exercise 1 Store Data in View State In this exercise, you add custom values to the ViewState object and then test the behavior when browsing to different pages. 1. Create a new ASP.NET Web site named ClientState in either C or Visual Basic using Visual Studio 2005. 2. In the blank project, on the Default.aspx page, add a label named Labell, a button named Buttonl, and a hyperlink...

Lesson Review

You can use the following questions to test your knowledge of the information in Lesson 3, Working with Web Configuration Files. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of of the book. 1. You want to make a configuration setting change that will be global to all Web and Windows applications on the...

Lesson Review Gjh

You can use the following questions to test your knowledge of the information in Lesson 2, Working with Data-Bound Web Server Controls. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer is right or wrong are located in the Answers section at the end of the book. 1. You want to display an image that is selected somewhat randomly from a collection of images. What is the best approach...

Lesson Review Fwm

You can use the following questions to test your knowledge of the information in Lesson 2, Exploring Common Web Server Controls. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. If you want multiple RadioButton controls to be mutually exclusive, what property must you set Choose one. 2....

Lesson Review Ywk

You can use the following questions to test your knowledge of the information in Lesson 1, Performing Input Validation. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. You prompt the user to enter a code that exists in the database. How can you validate this input A. Provide a...

Lesson Review Rpx

You can use the following questions to test your knowledge of the information in Lesson 2, Performing Site Navigation. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer is right or wrong are located in the Answers section at the end of the book. 1. Which of the following server-side methods can be used on the HttpServerUtility to navigate to a different Web page without requiring a...

Lesson Review Ven

You can use the following questions to test your knowledge of the information in Lesson 1, Using Client-Side State Management. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. You need to store a user's user name and password as he or she navigates to different pages on your site so that you can...

Lesson Review Mzh

You can use the following questions to test your knowledge of the information in Lesson 2, Using Server-Side State Management. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer is right or wrong are located in the Answers section at the end of the book. 1. In which file should you write code to respond to the Application_Start event Choose the best answer. A. Any ASP.NET server...

Lesson Review Rza

You can use the following questions to test your knowledge of the information in Lesson 1, Using a Server Control. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. To add an HTML Web server control to the Web page, you must drag an HTML element from the ToolBox to the Web page and then perform...

Take a Practice Test Nse

The practice tests on this book's companion CD offer many options. For example, you can test yourself on just the content covered in this chapter, or you can test yourself on all the 70-528 certification exam content. You can set up the test so that it closely simulates the experience of taking a certification exam, or you can set it up in study mode so that you can look at the correct answers and explanations after you answer each question. For details about all the practice test options...

Take a Practice Test Vqx

The practice tests on this book's companion CD offer many options. For example, you can test yourself on just the content covered in this chapter, or you can test yourself on all the 70-528 certification exam content. You can set up the test so that it closely simulates the experience of taking a certification exam, or you can set it up in study mode so that you can look at the correct answers and explanations after you answer each question. For details about all the practice test options...

Adding a Custom Web Server Control to the Toolbox

In the previous example, the control was added to the Web page dynamically by placing code in the code-behind page to instantiate and set the properties of the control. If you choose this method, you may also want to drag and drop your custom control from the Toolbox onto a Web page. This basic requirement to having your Web control in the Toolbox is that the Web control be placed into a .dll file. In the case of the previous LogoControl example, the LogoControl class has been added to a Class...

Lesson Review Ejg

You can use the following questions to test your knowledge of the information in Lesson 2, Using Windows, Forms, Passport, and Anonymous Authentication. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. Which of the following Web.config segments correctly requires that all users be authenticated...

Lesson Review Tbt

You can use the following questions to test your knowledge of the information in Lesson 1, Exploring Specialized Web Server Controls. The questions are also available on the companion CD if you prefer to review them in electronic form. Answers to these questions and explanations of why each answer choice is right or wrong are located in the Answers section at the end of the book. 1. Which of the following represents the best use of the Table, TableRow, and Table-Cell controls Choose one. A. To...