Overview
These assignments each explore particular tasks in VB and ASP. They emphasize one or two specific skills. The endo of the quarter project is meant to provide a more comprehensive excercise which brings together all the skills you have practiced
Turning in Assignments
For most assignments you can turn in the source code of the web page and the VB code behind. You can also zip the website folder and send the whole thing to me if you wish. To do this though, you have to change the .zip extenstion to something else, becuase the school mail server strips out all .zip files as potentially hazardous. I would suggest chaning it to ".piz".
Sometimes I will ask to see the assignment in class, because there are elements that may be hard to judge from the code alone.
Assignment One
Instructions
This assignment gives you practice with ASP pages, server controls, code behind, stylesheets, arrays, loops and if then statements
- Create a new ASP.Net Web Site
- Add a calendar control to your webform
- Pick one of the autoformat styles
- Add a label control below the calendar
- Double click the calendar to go to the code behind in the default selection changed event for the calendar
- Create a two dimensional string array called myEvents with 5 rows and 2 columns.
- For the first element assign a date, for the second element assign an event like the following example
MyEvent(0,0)="2/14/2007" myEvent(0,1)="Valentine Day"
- Loop through the array to see if the Calender1.SelectedDate.ToShortDateString matches a date in the array.
- if it does assign the event (x,1) to the label's text property
- Test this until you get it to work
- Add an h1 element above the calendar that has your name and Events--for example "Steve's Events"
- Add a style Sheet to the Assignment
- in it make the color of the h1 element Navy
- Create a class .event with a color of red
- Add the stylesheet to the Default.ASPX by typing <link rel="stylesheet" type="text\css" href="stylesheet.css" />
- Assign the class .event to Label1.
- Run the web page
To Turn in
Turn in the VB code, the source code for the form, and the Stylesheet
Assignment Two
This assignment gives you practice with server controls, stylesheets and maintaining state through session variables
Instructions
- Create a new web site
- In the Default.AspX page Add textboxes and labels for a person to enter their personal information (Name, address, city, state, zip, phone, email)
- Add validation controls requiring Name, Address, City, State, and zip also use the reqular expressions validation the email address
- Add a button that says Register
- Add a second web page
- When you click the button on the first web page (Default.aspx) the information should be transferred to the second page where the person should be shown the information they added and thanked
- Use session variables to transfer the information between pages
- Add a stylesheet and controls as you wish to give the pages a more professional feel and appearance
To turn in
Let me see the program run. Send me the code behind, the source code for both pages and the stylesheet
Assignment 3
This assignment has you work with ADO connection object, command object, DataReader object and Datatable object
Instructions
- First download the automart.sql script.
- Open the Sql Server Management Studio, connect and start a new query window.
- Paste or load the script into the query window and run it. It will create the automart Database
- After successfully creating the database, Open Visual Studio and start a new web site
- Add a DropDownList, and a Gridview
- In the smart tag for the DropDownList enable auto postback
- Using the ADO objects (connection, command, datareader) to connect to the database, get the Customer ID (CID) and the customer's last name (CLastName).
- You will need to pay attention to Postback issues
- Set it so that when you click on a name in the list it shows that customers vehicles (this will require using a command parameter)
- Use style sheets, html and whatever other controls you want to make the page look professional. (for extra, you might try substituting the DataList control for the GridView Control. It can give you a nicer output but takes quite a bit more configuration)
To turn in
Turn in the source code of the page and the VB code behind
Assignment 4
For this assignment we are going to make a web service that information about the services Automart offers and the locations of their stations
Instructions
- In Visual Studio, 0pen a new web service(this must be done in http mode--localhost, NOT filemode)
- Add two web functions: the first will return all Automart locations as a dataset
- The second functions will return a list of services and their prices as a dataset
- Add a description of the web service and each web function
- Test the procedures and debug any errors
- Create a client Web Site application (this can be file mode if you wish).
- Create a home page which displays locations and services. Use list a DataList for the Locations and a GridView for the services. Arrange it however you like.
- Use the wizard to bind the controls to the web service object.
To turn in
Turn in the VB code of the web service and the source for the client web page
Assignment 5
In this assignment you will Add a master detail page to the web page you created in assignment 4 using databound controls. This time we will call a database stored procedure directly from the wizard.
Instructions
Here is the code for the stored procedure. Copy it and paste it into a new query window in SQL Server Management Studio. Run the query to create the procedure
use Automart go Create proc carMaintenance @license as char(10) As Select Lname, SHDate, SName, SCharge, mid, smLastName From Location l inner join ServiceHistory sh on l.LID=sh.LID inner join ServiceHistoryDetail shd On sh.SHID=shd.SHID inner Join StoreManager sm on sm.SMID=shd.SMID inner Join AutoService s on s.SID=shd.SID Where VLicense=@license
- Open the web site from Assignment4.
- Add a new web form
- Add a gridview, use the datasource wizard to bind it to the vehicle table.
- Enable Select
- Add either a second Gridview or a listview control to the page. Use the wizard to bind the datasource to the stored procedure and pass it the license number
- format the page as you wish
- Make a link to the page from the web page for assignment 4.
To turn in
There really shouldn't be any code behind, so just turn in the page source
Project overview
The project is designed for you to put all the pieces together. Ideally you should work in groups of three or four. The first step is to come up with a project idea. First the project must be database driven. You can use our database, or create a new one. I want the project to include some elements we haven't covered so that you can practice your research skills. It is essential to know how to find the information you need.
Instructions
Determine the project idea, write it up. I must approve it
The project should include
- The proposal
- At least 3 web pages
- 3 or 4 data bound controls
- 4 or 5 additional asp controls (at least two of which should be ones we never used in class)
- at least one of the Validation controls
- 2 or more code behind pages--one of which should have some ADO code
- Css Stylesheets
- Either login controls or Master pages (though you can do both)
To turn in
These are things I want to see from the project
- A written description of the proposed project
- The project folder zipped (if you email it to me change the .zip extension to .piz)
- a list of resources used
- A check list of all the required items
- A list of group members and their contributions
The presentation
Each group will present their project. The presentation does not need to go over every little thing you did. Rather you should focus on the following
- Show the project running
- Tell what aspects were the most difficult
- Tell what aspects you are most proud of
- Be prepared to take questions
Assignment 6
For this assignment we will use filestream to create and write and read a log file that records when the web page connects to the SQL server. See pages 401-404)
Instructions
- Open the web page for assignment 4
- Add a method to the page to log the connections. Call this method every time a connection to the server is made.
- Add a second web form
- Put a multiline text box and two buttons on the page
- The first button will be to read the log file
- The second button will be to delete it
- Open the selected file to read
to Turn in
Turn in all the code behind on both pages
Assignment 7
For this assignment we will use the Web Configuration tool and set up form authentication. We are going to create a very simple application in which users must log on, and what pages they can see depends upon their role.
Instructions
- Use the web site configuration tool to switch to forms authentification and to create two roles "HR" and "Guest"
- Create 3 users, one who is a member of the HR role and two who are members of the guest role
- This application will use several pages.
- Login.aspx This page will have the login control and will direct users who successfully log in to the Welcome.aspx page
- The Welcome page, which contains two hyperlinks, one to Employees.aspx and one to loctions.aspx.
- Employees.aspx should have the loginview control. In the Logged in template put a DataView that is bound to a SQLDataSource control that connects to the mechanics Table. Include all the fields. Use the Advanced button to make these fields editable. And add the update button. This page should only be viewable if the user currently logged in is a member of the HR role. If the user is not a member of the HR role, they should be redirected to the NoPrivs.aspx page. In the anonymous template include a message and a loginstatus control
- NoPrivs.aspx, should have text saying something about not having permissions to view the employee page and a link back to the welcome page
- The Location page should have a loginView control also, but anyone in any role can view it as long as they are logged in. In the loggedin view include a datalist that shows all the Locations and their address information. You can use a sqlDataSources. In the anonymous section include a message something like, please log in to see the product list, and a loginStatus control.
- You will only have to enter two lines of actual code in the application. This will be in the PageLoad event of the Employees.aspx. In it you will have to test for the users role.(you can also use roles in the logged in template)
If User.IsInRole("HR")=false then
Response.Redirect("NoPrivs.aspx")
End If
Feel free to make it pretty.
To turn in
There is a lot here and very little code. I think just demonstrate to me that everything works