Académique Documents
Professionnel Documents
Culture Documents
Web Application
In the Resource Toolkit, see the resources “Types of Web Sites in Visual
Web Developer” and “How to: Create a File-System Web Site.”
7. In the Toolbox, expand the HTML section and then drag a Table control
onto the Default.aspx page.
8. On the View menu, click Properties Window.
9. In the Properties window, click the Width property and then type 100%
10. In the Design window, right-click the table, point to Insert, and then click
Row Below.
11. Select the three cells in the first row of the table. On the Layout menu, click
Merge Cells.
12. Select the newly merged cell. In the Properties window, click the Align
property and then type right in the combo box.
13. Click the leftmost cell in the second row. In the Properties window, click the
Style property and then type width:10%
14. Click the rightmost cell in the second row. In the Properties window, click
the Style property and then type width:10%
15. Select the three cells in the fourth row of the table, and then on the Layout
menu, click Merge Cells.
16. Select the newly merged cell. In the Properties window, click the Align
property and then type right in the combo box.
17. Drag an Image control from the Standard section of the Toolbox to the
first row of the table.
18. In the Properties window, click the ImageUrl property and then type
AdvWorksLogo.gif
19. Drag a Label control from the Standard section of the Toolbox to the
leftmost cell in the second row.
20. In the Properties window, click the Text property and then type Home
21. In the Properties window, expand the Font property, click the Names
property, and then type Verdana
22. Drag a Hyperlink control from the Standard section of the Toolbox to the
second cell in the second row.
23. In the Properties window, click the Text property and then type Contact Us
24. In the Properties window, click the NavigateUrl property and then type
Contact.aspx
25. In the Properties window, expand the Font property, click the Names
property, and then type Verdana
26. Drag an Image control from the Standard section of the Toolbox to the
leftmost cell in the third row of the table.
27. In the Properties window, click the ImageUrl property and then type
AdvWorksSideBar.gif
28. Click the second cell in the third row. In the Properties window, click the
VAlign property and then type top in the combo box.
29. Type Welcome to Adventure-Works.com and then select the text you just
typed.
30. On the Formatting toolbar, click Heading 4 <H4> in the Block Format
drop-down list.
Unit 1 Lab Answer Key: Creating a Web Application 3
31. On the Formatting toolbar, click Verdana in the Font Name drop-down
list.
32. Drag an Image control from the Standard section of the Toolbox to the
rightmost cell in the third row of the table.
33. In the Properties window, click the (ID) property and then type BikeImage
34. Drag a Label control from the Standard section of the Toolbox to the
fourth row of the table.
35. In the Properties window, click the Text property and then type Copyright
Adventure Works 2005
In the Resource Toolkit, see the resource “How to: Create a Simple Web Page
in Visual Web Developer.”
20. In the Properties window, expand the Font property, click the Names
property, and then type Verdana
21. On the Web form, click the image control in the rightmost cell of the third
row and then press DELETE.
22. Drag a Button control from the Standard section of the Toolbox to the
rightmost cell in the third row.
23. In the Properties window, click the Text property and then type Show More
Contact Details
In the Resource Toolkit, see the resource “How to: Create a Simple Web Page
in Visual Web Developer.”
In the Resource Toolkit, see the resource “ASP.NET Web Page Code
Model.”
7. With the cursor placed inside the Page_Load event procedure, on the Edit
menu, click Insert File As Text.
8. In the Files of type list, click Text Files (*.txt).
If you are working with Visual Basic, browse to E:\Labfiles\Starter\VB
and then click VB_PageLoad.txt.
If you are working with Visual C#, browse to E:\Labfiles\Starter\CS,
and then click CS_ PageLoad.txt.
9. Click Open.
The code loads either an image of a red bike or an image of a blue bike
based on a random number generator.
2. On the Website menu, click Set As Start Page and then press F5.
3. In the Debugging Not Enabled message box, click Run without
debugging and then click OK.
Microsoft Internet Explorer will open, displaying the Web page.
4. Note the color of the bike image. Click the Contact Us hyperlink, and then
click Show More Contact Details to show the contact details. Click Hide
Contact Details. Click the Home hyperlink to return to the home page.
5. Close Internet Explorer.
In the Resource Toolkit, see the resource “How to: Build a Web Application.”
Task 2: Manage the default web.config file for the Web server
1. On the Start menu, point to All Programs and then point to Microsoft
Visual Studio 2005.
2. On the Microsoft Visual Studio 2005 menu, right-click Microsoft Visual
Studio 2005 and then click Run as.
3. Select The following user option and then type Administrator in the User
name text box.
4. Type Pa$$w0rd in the Password text box and then click OK.
5. If you are prompted to choose the default environment settings for
Microsoft Visual Studio® 2005, click General Development Settings, and
then click Start Visual Studio.
6. On the File menu, point to Open and then click File.
7. Browse to
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG, and then
double-click web.config.
8. Locate the <system.web> element and then type
<customErrors mode="On" /> as a child element.
9. On the File menu, click Save web.config.
10. Switch to the first instance of Visual Studio 2005.
11. Click the Contact.aspx tab above the Design window.
12. Making sure the cursor is not inside the <script> element, on the View
menu, click Designer.
13. Double-click the form background (outside of the table).
An event procedure for the Page_Load event of the page is created.
14. With the cursor inside the event procedure, on the Edit menu, click Insert
File As Text.
15. In the Files of type list, click Text Files (*.txt).
If you are working with Visual Basic, browse to E:\Labfiles\Starter\VB
and then click VB_Exception.txt.
If you are working with Visual C#, browse to E:\Labfiles\Starter\CS and
then click CS_ Exception.txt.
16. Click Open.
Unit 1 Lab Answer Key: Creating a Web Application
Task 3: Add and manage the web.config file for the Web application
1. In the Solution Explorer window, if Visual Studio 2005 has added a file
called web.config, double-click it and proceed to step 4. If it hasn’t, proceed
to step 2.
2. On the Website menu, click Add New Item.
3. In the Templates pane, click the Web Configuration File item and then
click Add.
A new Web.config file will be added to your project and will appear in
Solution Explorer and the Design window.
4. Locate the <system.web> element, and then type
<customErrors mode="Off" /> as a child element.
5. Press CTRL+F5 to run the application.
6. Click the Contact Us hyperlink.
The Test Error page appears. This page contains information about the
specific code that caused the error.
7. Close Internet Explorer.