Projects
Projects
doc
Projects for
Murachs ASP.NET 4 Web Programming
with C# 2010
The projects in this document let you apply the programming skills you learn in
Murachs ASP.NET 4 Web Programming with C# 2010 by developing an application
called SportsPro. This application is designed for the technical support department of a
hypothetical software company that develops software for sports leagues. The purpose of
the application is to track technical support service calls (referred to as incidents) in a
database that also stores information about the companys customers, software products,
and technicians. The application uses a database called TechSupport. Before you do any
of the projects, you should read the introductory information that follows.
The projects........................................................................ 6
Project 1-A: Display customers..................................................................................6
Project 1-B: Create a contact list................................................................................7
Project 2-A: Survey customers.................................................................................10
Project 2-B: Create a master page and content pages............................................13
Project 2-C: Add site navigation...............................................................................15
Project 3-A: Display customer incidents...................................................................16
Project 3-B: Maintain products.................................................................................17
Project 3-C: Maintain customers..............................................................................19
Project 3-D: Maintain technicians.............................................................................21
Project 3-E: Display incidents..................................................................................23
Project 3-F: Display open technician incidents........................................................25
Project 3-G: Update incidents...................................................................................27
Project 4-A: Add user authentication........................................................................29
Project 4-B: Register products.................................................................................31
Project 4-C: Add custom error handling...................................................................33
2 358822727.doc
The SportsPro application consists of several pages that provide functions for three
types of users. First, it lets administrators perform functions such as maintaining the
Products, Customers, and Technicians tables of the TechSupport database. Second, it lets
technicians perform functions such as displaying and updating incidents. And third, it lets
customers perform functions such as registering products.
Each project has you add one or more new pages to the SportsPro application. For
example, project 3-A has you add a page that displays incidents by customer, and project
3-B has you add a page that maintains the data in the Products table of the TechSupport
database. If you complete all of these projects, youll have a relatively realistic web
application, although not all of the required functions will be implemented.
Note that the project numbers refer to the sections in the book. So, for example, you
can complete projects 2-A, 2-B, and so on after reading section 2, and you can complete
projects 3-A, 3-B, and so on after reading section 3. Because some of the projects dont
require that you have all of the skills presented in a section, though, you may be able to
complete a project before youve read all of the chapters in that section. In fact, many of
the projects require just the skills presented in a specific chapter. For example, project 2-
B requires the skills youll learn in chapter 9, and project 2-C requires the skills youll
learn in chapter 10.
To help you decide when you should be ready to complete a project, each project
description lists the chapters that are required for that project. Keep in mind, however,
that we recommend you read all of the chapters in section 1 before you complete any of
the projects for later sections since this section presents the basic concepts and skills for
developing web applications with ASP.NET 4.
3 358822727.doc
The TechSupport database is used to track technical support incidents for a small
software company named SportsPro. It consists of the six tables shown in the diagram
that follows. The main table is the Incidents table, which contains one row for each
technical support incident. Each row in the Incidents table is related to one row in the
Customers table, which contains information about the companys customers; one row in
the Products table, which contains information about the companys products; and one
row in the Technicians table, which contains information about the companys technical
support staff members. In addition, a table called Registrations keeps track of the
products that are registered to each customer, and the States table contains state and zip
code information.
In addition to the column properties shown above, you should know that the
CustomerID, IncidentID, and TechID columns in the Customers, Incidents, and
Technicians tables are identity columns. So the values of these columns are set
automatically when new rows are added to these tables.
4 358822727.doc
The projects for sections 1 and 2 use an Access version of the TechSupport database.
To do these projects, you can simply copy the TechSupport.mdb file your instructor gives
you to the App_Data folder of the application.
The projects for sections 3 and 4 use a SQL Server version of the TechSupport
database. If this database is installed on a server at your company or school, youll need
to get the information for establishing a connection to that database before you do these
projects. On the other hand, if youre going to use SQL Server Express on your own PC
to do these projects, youll need to start by creating the TechSupport database.
To create the TechSupport database on your own PC, copy the TechSupport.exe file
that your instructor gives you to your C drive, and double-click on this file in Windows
Explorer to execute it. Then, navigate to the C:\Murach\aspnet4_cs\project_database
directory and double-click on the create_TechSupport.bat file to execute it. This batch file
runs a SQL Server script named create_TechSupport.sql that creates the database in the
copy of SQL Server running on your computer.
Note that if the database server on your system has a name other than the computer
name appended with \SQLEXPRESS, the batch file we provide wont work. But you can
easily change it so it will work. To do that, just open the file in a text editor such as
NotePad. When you do, youll see a single command with this server specification:
sqlcmd -S localhost\SQLExpress -E /i create_TechSupport.sql
Then, you can just change this specification to the name of your server. Youll also need
to make this change before you can use the other batch files we provide.
If youll be running the applications that use the SQL Server version of the database
under IIS, youll also need to grant ASP.NET access to the database. To do that under
Windows XP, you can run the grant_access_windows_xp.bat file in the project_database
directory. But first, you must modify the grant_access_windows_xp.sql file that this batch
file runs so it uses the name of your computer. To do that, open the file in a text editor,
and replace each occurrence of [machineName] (including the brackets) with the name of
your computer. Then, save and close this file, and run the grant_access_windows_xp.bat
file.
You use a similar technique to grant ASP.NET access to the TechSupport database
under Windows 7 and Windows Vista. Specifically, you run the
grant_access_windows_7_vista.bat file, which runs the
grant_access_windows_7_vista.sql file. If you open this file, youll see that it actually
grants access to the ASP.NET 4 application pool. This is the application pool that your
ASP.NET 4 applications will run in by default if you run them under IIS.
As you test some of the projects that you develop, youll need to add, modify, and
delete rows in the database. Then, at some point, if youre using SQL Server Express on
your own PC, you may want to restore the original data. To do that, you can just run the
create_TechSupport.bat file again. This deletes the existing database and recreates it with
the original data. Before you run this batch file, be sure to close any applications that are
using the database.
5 358822727.doc
Unless youre asked to do otherwise, you can develop the SportsPro application as a
file-system web site, and you can test it using your default browser and the built-in
development server. If youre asked to develop and test the application under IIS,
however, you will need to have IIS installed. You will also need to have IIS installed if
youre assigned project 4-B, which sends confirmation messages by email. You can learn
how to install IIS in figure A-2 (Windows 7 or Windows Vista) or A-3 (Windows XP) of
appendix A in the book. Note, however, that you should install IIS before installing
Visual Studio 2010.
The description of each project includes the general operation of the projects pages,
an image of how the pages should appear in a browser, and specifications for the
processing the pages should do. This information is detailed enough for you to complete
the project. However, youll occasionally need to determine minor details on your own,
such as what error messages to display when the user enters invalid data.
The names of the forms youll create for each project are also given in the project
description. To avoid conflicts with later projects, you should use the indicated names.
You should also use the names specified in the project descriptions for any other classes
youre asked to create.
Unless youre instructed otherwise, you are free to implement each project using any
programming techniques you wish. In some cases, however, the projects specifications
will direct you to use a specific programming technique. For example, a project may
direct you to use session state or cross-page posting. In that case, you should implement
the project as directed.
Because the book doesnt require that you know the details of using HTML and CSS,
you can use tables to define the layout of each page. If youre familiar with CSS, though,
you may want to use it instead since this is the preferred technique. Just be sure that your
focus is on using the ASP.NET skills youve learned and not on coding HTML and CSS.
6 358822727.doc
Operation
When the page is first displayed, the information for the first customer in the drop-
down list is displayed on the page. After that, the information for the customer that the
user selects from the drop-down list is displayed.
Specifications
Create a class named Customer that contains a public property for each column in the
Customers table. Then, use this class to create a Customer object that contains the
information for the selected customer.
Add an Access data source to the page that retrieves all the rows and columns from the
Customers table and sorts them by the Name column. Bind the drop-down list to this
data source so the Name column is displayed for each item in the list and the
CustomerID column is stored as the value of each item.
To get the data for a selected customer, create a data view from the data source and then
filter the data view so it consists of just the row for the selected customer.
Use a table to align the address, phone, and email information.
Use any fonts, colors, and sizes you like for the two headings.
7 358822727.doc
Specifications
Create a class named CustomerList that can be used to store and work with the
customers that are added to the contact list. This class should include a private field that
stores a List<Customer> object, along with the following members:
Indexers
public Customer this[int index]
Gets or sets the customer at the specified index.
public Customer this[string name]
Gets the customer with the specified name.
Properties
public int Count
Returns a count of the number of customers in the list.
Methods
public CustomerList()
Creates a new List<Customer> object and stores it in the private field.
public static CustomerList GetCustomers()
Gets the list of customers from session state. Creates a new session state item if one doesnt
already exist.
public void AddItem(Customer customer)
Adds a customer to the list of customers.
public void RemoveAt(int index)
Removes the customer at the specified index from the list of customers.
public void Clear()
Clears the list of customers.
When the Add to Contact List button on the Customer Display page is clicked, the
application should use the GetCustomers method of the CustomerList class to get the
9 358822727.doc
current list of customers from session state. Then, it should check that a customer with
the same name as the selected customer isnt already in the list by using the overloaded
indexer of the CustomerList class. Finally, if the customer isnt already in the list, it
should use the AddItem method of the CustomerList class to add the customer to the
list.
When the Contact Display page is loaded, the application should retrieve the customer
list from session state. Then, it should use a for statement, along with the indexers and
Count property of the CustomerList class, to display the customers in the list box.
When the Remove Contact button is clicked, the application should use the RemoveAt
method of the CustomerList class to remove the customer from the customer list, and
when the Empty List button is clicked, the application should use the Clear method of
the CustomerList class to clear the customer list.
To format the customer data thats displayed in the list box, add a method named
ContactDisplay to the Customer class that returns the customer data in the correct
format.
Use cross-page posting to display the Contact Display page when the user clicks the
Display Contact List button on the Customer Display page and to display the Customer
Display page when the user clicks the Select Additional Customers button on the
Contact Display page.
Instructor note
To make this project easier, you can provide your students with the code for the
CustomerList class.
10 358822727.doc
Operation
When the Customer Survey page is first displayed, all of the controls except for the
Customer ID text box and the Get Incidents button are disabled.
When the user enters a customer ID and clicks the Get Incidents button, any closed
incidents for that customer are displayed in the list box and all of the controls on the
page are enabled. If there arent any closed incidents, the controls are not enabled and
an appropriate message is displayed below the customer ID.
To complete the survey, the user selects an incident, makes the appropriate selections
and entries, and then clicks the Submit button. Then, the Survey Complete page is
displayed with a message that depends on whether or not the user has asked to be
contacted. The user can close this page or complete another survey by clicking the
Return to Survey button.
Specifications
Create a class named Incident that consists of one public property for each column in
the Incidents table and a method named CustomerIncidentDisplay that formats an
incident for display on the Customer Survey page.
Create a class named Survey that consists of the following properties that represent the
data for a survey:
public int CustomerID { get; set; }
public int IncidentID { get; set; }
public int ResponseTime { get; set; }
public int TechEfficiency { get; set; }
public int Resolution { get; set; }
public string Comments { get; set; }
public bool Contact { get; set; }
public string ContactBy { get; set; }
Use labels instead of text within the survey so you can enable and disable them along
with the other controls.
Use radio button lists to implement the ratings for the three categories in the survey.
The Text properties for the list items in these lists should be set as shown on the page,
and the Value properties should be set to 1, 2, 3, and 4.
Use a radio button group for the last two radio buttons on the page.
Use required field validators for the Customer ID text box and the Incidents list box,
and use a compare validator for the Customer ID text box that checks for an integer
value. In addition, use validation groups so that the validators for the Customer ID text
box are executed only when the user clicks the Get Incidents button, and the validator
for the Incidents list box is executed only when the user clicks the Submit button.
When the Customer Survey page is first displayed, set the focus to the customer ID text
box. Then, if the user clicks the Get Incidents button and there are incidents for the
specified customer, move the focus to the Incidents list box.
To get the data thats displayed in the Incidents list box, use an Access data source that
retrieves all the rows and all the columns except the Description column from the
Incidents table, sorted by the DateClosed column. Then, use a data view to filter the
rows so that only the closed incidents for the specified customer are displayed. To do
that, youll need to set the RowFilter property of the data view to a compound
12 358822727.doc
condition where the CustomerID column is equal to the customer ID the user enters
and the DateClosed column is not null.
When populating the Incidents list box, create list items whose Text property is set to
the value of the CustomerIncidentDisplay method of the incident and whose Value
property is set to the incident ID. In addition, the Text property of the first item in the
list box should be set as shown on the Customer Survey page, and the Value property of
this item should be set to None.
When the survey is submitted, the application should create a Survey object and set its
properties appropriately. Then, it should save a Boolean value in session state that
indicates if the user requested to be contacted. The Survey Complete page can then use
that value to determine the message thats displayed on the page. (Although a complete
application would also perform some processing on the Survey object, this project
doesnt include that processing.)
13 358822727.doc
Operation
When the user clicks one of the links at the top of the page, the appropriate page is
displayed.
When the user clicks the E-mail link under How to contact us or at the bottom of the
page, the users email client starts a new email for the specified address.
Specifications
The master page consists of the two titles and three links at the top of the page and the
contact information at the bottom of the page. You can use any fonts, colors, and sizes
you want for these elements. If you format the elements on the master page using styles
14 358822727.doc
in an internal or external style sheet, be sure to use custom names for the styles so the
names dont conflict with the names of styles used in the content pages.
After you create the master page, you can create the Contact Us page as a content page
that will be displayed within the master page. In addition, you can convert the pages
you created in previous projects to content pages. When you do that, dont forget to set
the titles for the master and content pages the way you want them.
To create the two email links, you can use a hyperlink with its NavigateUrl attribute set
to mailto:[email protected].
15 358822727.doc
Specifications
To implement this project, youll need to add several forms to the application. You
should give these forms the following names: Default.aspx, CustomerSupport.aspx,
ProductRegistration.aspx, TechnicianSupport.aspx, CustomerIncidentDisplay.aspx,
IncidentUpdate.aspx, Administration.aspx, ProductMaintenance.aspx,
CustomerMaintenance.aspx, TechnicianMaintenance.aspx, IncidentDisplay.aspx,
TechnicianIncidentSummary.aspx, and Map.aspx. The only page youll implement in
this project is the Map page.
After you create the necessary pages, you can create a web.sitemap file with the
structure shown in the tree view above. Then, you can replace the links at the top of the
master page with a Menu control, and you can add a TreeView control to the Map page.
16 358822727.doc
Operation
When the user selects a customer from the drop-down list, all the incidents for that
customer are displayed in a data list.
Specifications
The Customers drop-down list is bound to a SQL data source that retrieves the
CustomerID and Name columns from the Customers table and sorts the rows by the
Name column. When you create the connection for this data source, you should save it
in the web.config file.
The SQL data source for the data list joins data from three tables (Incidents,
Technicians, and Products) and includes only the incidents for the selected customer.
The Item template for the DataList control should contain a table with two rows. The
second row should contain a single cell that spans all four columns. To do that, you can
use the colspan attribute of the td element.
Format the data list any way you like.
17 358822727.doc
Operation
When the user clicks the Edit button for a product, the product data is displayed in edit
mode. Then, the user can modify the data and click the Update button to update the
database. The user can also click the Cancel button to cancel the edit operation.
When the user clicks the Delete button for a product, the product is deleted from the
database.
When the user enters the data for a new product into the text boxes and clicks the Add
Product button, the product is added to the database.
18 358822727.doc
Specifications
The SQL data source for this project should retrieve all the columns and rows from the
Products table, and it should sort the rows by the ProductCode column. It should
generate Insert, Update, and Delete statements and use optimistic concurrency.
The products should be displayed in a GridView control that provides for modifying all
the columns except for the ProductCode column. You can format this control any way
you like.
Validate the data the user enters into the grid to be sure that a product name, version,
and release date are provided and that the date is in a valid format. To do that, youll
need to use templates. Display an indicator next to any field that has an error, and
display the error messages in a validation summary control below the grid.
Validate the data the user enters for a new product to be sure that a value is entered for
each field and that the date is in a valid format. Display error messages to the right of
any fields in error.
When a product is updated or deleted, display an error message if an exception occurs
or if the operation could not be performed.
When a product is added, display an error message if an exception occurs. Otherwise,
initialize the text boxes to prepare for the next entry.
Be sure to set the EnableViewState property of the label you use to display error
messages to False so its reset to its initial value each time the page is loaded.
19 358822727.doc
Operation
When the user clicks the Select button for a customer in the GridView control, the data
for that customer is displayed in the DetailsView control. To locate a customer, the user
can use the page controls at the bottom of the GridView control or click on a column
heading to sort the customers by that column.
When the user clicks the Edit button for a customer, the customer data is displayed in
edit mode. Then, the user can modify that data and click the Update button to update
the database. The user can also click the Cancel button to cancel the edit operation.
When the user clicks the Delete button for a customer, the customer is deleted from the
database.
20 358822727.doc
When the user clicks the New button, the DetailsView control is placed in insert mode.
Then, the user can enter the data for the customer into the text boxes that are provided
and click the Insert button to add the customer to the database. The user can also click
the Cancel button to cancel the insert operation.
Specifications
The SQL data source for the GridView control should retrieve the three columns shown
in the grid from the Customers table plus the CustomerID column, and it should sort
the rows by the Name column.
The SQL data source for the DetailsView control should retrieve all the columns for the
customer thats selected in the GridView control. It should generate Insert, Update, and
Delete statements, and it should provide for optimistic concurrency.
This project does not require validation controls. However, it should check for
exceptions and concurrency errors and display an appropriate message if one occurs.
Be sure to set the EnableViewState property of the label you use to display messages to
False so its reset to its initial value each time the page is loaded.
Format the GridView and DetailsView controls any way you like, but be sure to
provide for sorting and paging in the GridView control.
Instructor note
If you want to make this project more difficult, you can have your students use
templates with the DetailsView control. In particular, you can have them replace the
text box for the state with a drop-down list thats bound to a SQL data source that
retrieves all the states from the States table.
21 358822727.doc
Operation
When the user selects a technician from the drop-down list, the data for that technician
is displayed in the FormView control.
When the user clicks the Edit button for a technician, the technician data is displayed in
edit mode. Then, the user can modify that data and click the Update button to update
the database. The user can also click the Cancel button to cancel the edit operation.
When the user clicks the Delete button for a technician, the technician is deleted from
the database.
When the user clicks the New button, the FormView control is placed in insert mode.
Then, the user can enter the data for the technician into the text boxes that are provided
and click the Insert button to add the technician to the database. The user can also click
the Cancel button to cancel the insert operation.
22 358822727.doc
Specifications
The SQL data source for the drop-down list should retrieve the TechID and Name
columns from the Technicians table and sort the rows by the Name column.
The SQL data source for the FormView control should retrieve all the columns for the
technician thats selected in the drop-down list. It should generate Insert, Update, and
Delete statements, and it should provide for optimistic concurrency.
Validate the data the user enters into the FormView control to be sure that a technician
name, email, and phone number are provided. Display an indicator next to any field
that has an error, and display the error messages in a validation summary control to the
right of the FormView control.
Check for exceptions and concurrency errors, and display an appropriate message
below the FormView control if one occurs.
Format the FormView control any way you like.
23 358822727.doc
Operation
When the page is first displayed, information for the first four incidents is displayed in
the ListView control. Then, the user can click the Next and Previous link buttons in the
DataPager control to display additional incidents.
24 358822727.doc
Specifications
The SQL data source for the ListView control should retrieve the DateOpened,
DateClosed, Title, and Description columns from the Incidents table. This table should
be joined with the Products, Customers, and Technicians tables so the Name column
from each of these tables can be retrieved. You will need to assign an alias to at least
two of the name columns since the column names are the same.
Format the ListView and DataPager controls as shown above. One way to do that is to
configure the ListView control using Grid layout. Then, you can remove the outer table
from the Layout template thats generated and place the DataPager control in a separate
table. Next, within the table row for the Item and Alternating Item templates, you can
code a single table cell that spans all three columns of the table in the Layout template.
(To do that, you use the colspan attribute.) Within that cell, you can code a table that
defines the format of the data.
25 358822727.doc
Operation
When the page is first displayed, the incident information for the first technician in the
drop-down list is displayed in a GridView control. After that, the information for the
technician that the user selects from the drop-down list is displayed.
Specifications
The drop-down list is bound to an object data source thats associated with a
TechnicianDB business object. The select method in this business object should
retrieve all technicians and sort them by the Name column.
The GridView control is bound to an object data source thats associated with an
IncidentDB business object. The select method in this business object should retrieve
only the open incidents for the technician thats selected in the drop-down list. It should
26 358822727.doc
join the Incidents table with the Customers table so the customer name can be
displayed. And it should sort the results by the DateOpened column.
Because the select methods in both business objects retrieve data from the TechSupport
database, you should create another class named TechSupportDB that contains a public
function that gets the connection string from the web.config file.
27 358822727.doc
Operation
When the user selects a customer from the drop-down list, all the incidents for that
customer are displayed in a GridView control.
When the user clicks the Edit button for one of the Incidents, the incident is displayed
in edit mode. Then, the user can change the date closed or the description for the
incident and click the Update button to update the database. The user can also click the
Cancel button to cancel the edit operation.
Specifications
The Customers drop-down list is bound to an object data source thats associated with a
CustomerDB business object. The select method in this business object should retrieve
only the customers who have incidents that have been assigned to a technician and sort
them by the Name column. To select these customers, you can use a subquery in the
Select statement like this:
SELECT CustomerID, Name
FROM Customers
WHERE CustomerID IN
(SELECT DISTINCT CustomerID FROM Incidents
WHERE TechID IS NOT NULL)
ORDER BY Name
The GridView control is bound to an object data source thats associated with an
IncidentDB business object. The select method in this business object should retrieve
only the incidents for the selected customer that have been assigned to a technician.
When the user clicks the Update button, the update method in the IncidentDB business
object should be used to update the incident. To do that, youll need to create and
execute a command object with the appropriate Update statement. Be sure the Update
statement implements optimistic concurrency and that it provides for null values in the
DateClosed column.
Because the Description column can contain up to 2000 characters, youll want to
display it in a multiline text box. To do that, you need to convert the Description field
in the GridView control to a template field and then set the properties of the text box
appropriately.
If you want to change the width of the text box thats displayed for the DateClosed
field, change the Width property of the ControlStyle element for that field.
Because the DateClosed column of an incident can contain a null value, youll need to
include some additional code in the update method of the IncidentDB class to get this
method to work correctly. Thats because the value Jan 1 0001 12:00:00 AM is
passed to the method if the column is null, and that is not a valid DateTime value. So
your method will need to set the DateClosed parameter like this:
if (incident.DateClosed == Convert.ToDateTime("01/01/0001 12:00:00 AM"))
cmd.Parameters.AddWithValue("DateClosed", DBNull.Value);
else
cmd.Parameters.AddWithValue("DateClosed", incident.DateClosed);
Youll need to use similar code for the DateClosed column of the original incident.
Check for exceptions and concurrency errors when an incident is updated, and display
an appropriate message if one occurs.
Instructor note
If you prefer, you can have your students implement the select methods of the
CustomerDB and IncidentDB classes so they return Customer and Incident objects.
29 358822727.doc
Operation
When the user clicks a hyperlink on the Default page, a login page is displayed. Then,
if the user enters a valid user name and password and that user is authorized to view the
selected page, that page is displayed.
When the user clicks a hyperlink on the Administration, Technician Support, or
Customer Support page, the appropriate page is displayed. The user can also click the
Logout link on any of these pages to log out and redisplay the login page.
30 358822727.doc
Specifications
Add roles named Admin, Tech, and Customer. Then, add yourself as a user to the
Admin role, add the five technicians in the Technicians table as users to the Tech role,
and add at least a couple of customers from the Customers table to the Customer role.
When you add the users, youll want to develop a simple scheme for the passwords and
security questions and answers so you can remember them.
Add three new folders named Admin, Tech, and Customer to the web site. Then, use
the web.sitemap file to determine which pages to move to these folders, and update the
URLs for these pages in the web.sitemap file so they point to the correct locations.
When youre done, all of the pages except for Default and Map should be in a folder. If
any of the pages you move contain a button with a PostBackUrl attribute, youll need
to update that attribute as well so it points to the correct location.
Add access rules that only allow users in the Admin role access to the pages in the
Admin folder, that allow users in the Admin and Tech roles access to the pages in the
Tech folder, and that allow users in the Admin and Customer roles access to the pages
in the Customer folder.
The Login page should consist of just a Login control. You can format this control any
way you like.
Add the appropriate hyperlinks to the Default, Administration, Technician Support, and
Customer Support pages. In addition, include LoginName and LoginStatus controls on
the Administration, Technician Support, and Customer Support pages.
Instructor note
The users currently in the TechSupport web site are as follows:
Role Name Password
Admin Anne Anne$Boehm
Tech Alison Alison$Diaz
Jason Jason$Lee
Andrew Andrew$Wilson
Gunter Gunter$Wendt
Gina Gina$Fiori
Customer Kenzie Kenzie$Quinn
Kendall Kendall$Mayte
The password for each user is the users first and last names, separated by a dollar
sign. The security question for each user is What is your last name? And the
security answer for each user is the users last name starting with a capital letter. You
may want to add yourself as a user in the Admin role if you plan on demonstrating
this project to your students.
31 358822727.doc
Operation
When the user enters a valid customer ID and clicks the Get Customer button, the
customer name is displayed and the Register Product button is enabled. (This button is
disabled when the page is first displayed.)
When the user selects a product and clicks the Register Product button, a row is added
to the Registrations table, an email message is sent to confirm the registration, and the
controls on the page are reinitialized. If an error occurs, an appropriate message is
displayed.
Specifications
This page requires three data sources: one that gets the row for the specified customer
from the Customers table, one that gets a list of products from the Products table, and
one that can be used to insert rows into the Registrations table. Dont worry about
displaying just the products that the customer hasnt already registered. Instead, display
an error message if a duplicate key or any other exception occurs.
Validate the Customer ID text box to be sure the user enters an integer value that exists
in the Customers table. To do that, youll need to use three validators, including a
custom validator. Validate this text box only when the user clicks the Get Customer
button.
Validate the Products drop-down list to be sure the user has selected a value when the
Register Product button is clicked.
To confirm that the email message is sent correctly, youll want to send it to your own
email address.
33 358822727.doc
Operation
Any time an exception is caught by a try-catch statement, the application is redirected
to the error page shown above and the message associated with the exception is
displayed.
When the user clicks the Return button, the page that caused the exception is
redisplayed.
Specifications
Error handling should be added to the Product Maintenance and Product Registration
pages.
To be sure the error handling works for the Product Maintenance page, you can try to
add a product with a product code that already exists.
To be sure the error handling works for the Product Registration page, you can try to
add a duplicate registration. To determine what products are already registered to what
customers, you can use the Server Explorer in Visual Studio to display the data in the
Registrations table.
34 358822727.doc
You should create one page named ErrorMessage.aspx to display any application
errors.
Be sure to include the appropriate path in the statements that redirect to another page.
Operation
Any time an HTTP error occurs, a page similar to the one shown above is displayed.
Then, the user must end the application
Specifications
You should create three separate pages to handle HTTP errors. The first page, named
FileNotFound.aspx (shown above), should handle HTTP error 404. The second page,
named NoAccess.aspx, should handle HTTP error 403. And the third page, named
HttpError.aspx, should handle any other HTTP error. Each of these pages should
display appropriate messages.
To be sure that the error pages work, you can temporarily change the name of the page
in a Response.Redirect statement so the page cant be found. Then, the error page
shown above will be displayed.