Server-Side Web Programming with Active Server Pages
Lab 3 - Browser Detection Page and SQL Select Exercise

 
In this lab you will create an ASP page that detects the client's browser using the Browser Capabilities
Component, and also create several SQL Select statements. This assignment is worth 15 points and due on Saturday, September 23rd. Send an email to Chris indicating you have finished the assignment and providing the external URL to your pages.

Note: Several students have discovered that the browscap.ini file provided in Win2000/IIS5 and by Cyscape are pretty out-of-date, and have no entries for Netscape 4.75.  On 9/17 I edited Deathstar's browscap.ini file to recognize Netscape 4.75 (latest version).  I also discovered that Microsoft changed the way entries can be recorded in browscap.ini, eliminating the ability to capture the specific version number of a browser. So if you use the BCC with IE5.5, it will only list "5" as the version number, not 5.5. (see http://www.asptoday.com/articles/19990723.htm).

Part 1 - Browser Detection Page

In the first part of the lab, you will create an ASP page that detects the client's browser using the Browser Capabilities Component. If the client's browser is Internet Explorer, then the page uses this component to output information about the client browsers' capabilities.  If the client's browser is Netscape Navigator, then the page uses Response.Redirect to redirect the client to a separate page that also instantiates the Browser Capabilities component and outputs information about the client's Netscape browser. As always, you will create the pages using best page design practices.

Create a directory in your class child web called "Lab03". Create a page called default.asp which instantiates the Browser Capabilities Component and checks the user's browser. If the client's browser is not IE or Netscape, the page should only return the text "This page cannot detect your browser." If the client's browser is Internet Explorer, render the page below dynamically based on the client's browser. If the client's browser is Netscape Navigator, the default.asp page should redirect the client to a page called Netscape.asp" (see below) that similarly dynamically renders the client's browser.  

You are to replicate these two pages as closely as possible. Note that only the title area should span the entire width of the page. The browser logo graphics are listed at the end of this page, and the color code for the title area is #cccccc.

Lab 4 IE Screen

Lab 4 Netscape Screen

Internet Explorer Logo Netscape Navigator Logo

Part 2 - SQL Select Statement

Create a third page in your Lab03 directory called "SQL1.htm". Using the sample "Shop" database discussed in class, your page should list the questions below and provide a SQL statement (not the data) that would answer the question. 

1. Write a statement to display the product names in alphabetical order. Do not include products whose unit price is greater then $40.

2. Write a statement to select all products whose name begins with the letter 'p' or letter 't'.

3. Write a statement to select all products whose descriptions contain the word 'size'.

4. Count the number of customers with an invalid e-mail address (e.g. it does not contain a '@' character).

5. Show the product descriptions and prices for product numbers 4, 9, 16, 23 .

6. Show the order date and order # for all orders that have ordered any hat.


Valtara Digital Design  http://www.valtara.com/csc123/   
Copyright 1999, 2001, Valtara Digital Design, Blitzkrieg Software