Home > 2011 Winter BTI420 > BTI420 Lab 3

BTI420 Lab 3

February 4, 2011 Leave a comment Go to comments

Lab 3 helps you learn the topics for working with the web server’s file system. It is due on Friday, February 11.

.

BTI420 Lab 3 – due Fri Feb 11

Assigned: During Week 4

Due date: Friday, February 11, 2010, at 11:40am

Grade value: 3% of your final course grade

Grading method: The following will be checked:

  • Your “labs/lab3.aspx” page
  • Correct interactive operation of the page’s logic
  • Implementation of the specifications
  • Code writing quality, including commenting

.

Objective(s)

Work with the web server’s file system

Enable “file upload”

Perform file creation and editing operations

Read and process simple text files

.

Introduction to the problem that you will solve

A web form is needed that will allow a browser user to upload a text file to the web site. It will also allow the user to make a copy of the file with some additional data. Then, it will allow the user to view the contents of the modified file.

In addition, the page will allow the user to search the contents of the modified file, and display all matching lines of text in a multi-line textbox.

Therefore, in summary, the web form will allow these four tasks:

  1. Enable a browser user to upload a text file to the web site
  2. Allow the user to make a copy of the file, with some additional data added to it
  3. Enable the browser user to view the contents of the copied file
  4. Permit the user to search the contents of the copied file, and view the search results

.

A working example of Lab 3 is here. You DO NOT have to exactly copy the appearance and functionality. Your lab MAY look and work a bit different.

.

Specifications

Create a master page, which will be used for this lab, Lab 3, and the remaining two labs (Lab 4, and Lab 5). Locate it in your ui/mp folder, and call it something like “labs.master”.

Create lab3.aspx in your labs folder, and it will use your new “labs.master” master page that you just created.

On the web form, create four areas (divs). You can use ASP.NET Panel web server controls if you wish. You can apply a style to a panel, so that it has, for example, a distinct background colour. If you like this idea, do the following:

  • Show your Lab 3 aspx markup
  • In its head “content” area, add a CSS class for each panel
  • For each CSS class, add rules for the appearance you want
  • When adding and configuring a panel web server control, set its “CssClass” property to the CSS class you want it to use

.

First area – upload a text file: Create an area that will allow the user to upload a line-oriented text file to your web site. You must create a folder in your web site that will hold files that are created or modified with “file I/O” operations. We suggest: ~/assets/uploads

Obviously, you must use the recommended impersonation technique to make this possible for this lab4.aspx to make changes to the web server’s file system.

While you are testing, you can upload any line-oriented text file. Make sure it is big enough to be interesting; it must be 1,000 bytes/characters or larger, up to a maximum size of 100,000 bytes/characters. On a typical Windows-based computer, the C:\WINDOWS folder has lots of .txt and .log files which meet the criteria.

Hint: Save the web server’s full path and name of the file that was just uploaded. You will need this name in the second area…

.

Second area – copy and modify the uploaded file: Next, create an area on the page that will enable the user to make a copy of the uploaded file. Store the copy of the file in the same “assets/uploads” folder as the uploaded original.

Insert – at the top/beginning of the new file – your name, and the current warp server date and time. The name of the copied file will be in the format:

copy<filename.ext>

.

Third area – view a file: Then, provide a way for the user to view the contents of the file. You should probably show the user a list control (dropdown list? listbox?), to allow them to select the file they want to view, and then place the file’s contents into a multi-line textbox that shows the contents of the file.

.

Fourth and last area – search for text in a selected file: Finally, give the user a way to search the contents of a selected text file, and display the search results.

Use a simple search algorithm: Search for the entire search term entered by the user.

For example, if the user enters “hello”, search only for “hello”. If the user enters “hello world”, search only for the complete term “hello world”, and not the individual “hello” or “world” words/terms. (This makes it easier.) Make your search case-insensitive.

.

Submitting your work

Update your web site home page to add a link to this lab.

When you do a lab exercise, you are creating it online on the warp server. Therefore, you do NOT have to submit paperwork to your professor. Just do the lab, and your professor will find it (as long as it is in the right location!).

.


Advertisements
Categories: 2011 Winter BTI420
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: