Student Menu. © Lesson 4. Printable layout. Links won't function in print.

 

Notes Section

Main Text


Module 4.0

Error Handling
.

Remembering the following suggestions will help make debugging and ASP error handling much easier:

1. Use Option Explicit to avoid losing time due to typographic errors during development, but remove it afterwards to prevent any performance loss.

2. Use include files and sub routines as much as possible to recycle code.

3. Keep the distinctions between client-side and server-side scripting clear.

4. Follow appropriate naming conventions for variables.

5. Comment your code! Comment your code!

Please read, outline and paraphrase Chapter Nine. Work the Try It Out project for error handling with your own code if possible.


Module 4.1


Scripting Object.

The Scripting Object provides extra functionality to the scripting language; however, it isn't directly involved in client-server communication like the other built-in ASP objects.

The following Script Objects belong to the VBScript library: Dictionary Object, FileSystemObject Object and the TextStream Object.

1. The Dictionary Object permits information storage and retrieval by associating a particular piece of information with a key.

2. The FileSystemObject Object allows for the viewing and manipulation of directories (folders) and files on a web server's physical file system. Its object model has the following hierarchy:

2.1. Drive Object - Forms the Drives Collection and contains information about individual drives on the web server including space available, volume name, file system type or root folder reference.

2.2. Drives Collection - Has one drive object for each drive on the system including local, fixed, removable and network connected drives.

2.3. Folder Object - Provides access to folder properties including name, file contents, size and attributes in addition to referencing its subfolders. Used to copy, delete and move folders.

2.4. Folders Collection - Set of folder objects allowing for the addition of more folder objects much like creating subfolders within folders.

2.5. File Object - Residing at the lowest hierarchy, it provides access to all the properties of an individual file including names, paths, sizes and folder object references. Used to copy, delete and move files.

2.6. File Collection - Contains all file objects within a folder, each one corresponding to a particular folder or subfolder in the file system.

3. The TextStream Object lets you read and write information to text files stored on the web server. It has three methods of access:

3.1. With a valid file object, use the OpenAsTextStream method.


3.2. With a physical file name, use the OpenTextFile method.

3.3. To create and add text to a new file, use the CreateTextFile method and pass the name of the file to the FileSystemObject Object.

Please read, outline and paraphrase Chapter Ten and review Appendix B in the course textbook. Work the Try It Out project for the Scripting Object with your own code if possible.

 

Module 4.2

 

Exercise 4.

 
  1. Define any new vocabulary terms using the course textbook, the VBSLR and the online resources mentioned in Module 1.8.
  2. Remember that just as it took lots of time and practice to learn all the attributes and properties of HTML tags, so will be the case for the Properties, Methods, Events and Objects of ASP. Practice makes perfect!
  3. Please read, outline and paraphrase Chapter Seven and review Appendix A in the course textbook.
  4. Do all of the Try It Out exercises in Chapter Eight. You may be able to download the code from the book's publisher, Wrox, but it's better if you try writing your own based on what's shown in the course textbook.
  5. Take notes on this week’s materials including the Try It Out exercises and paraphrase them in your own words
  6. Don't forget to take the quiz, and collaborate with your online colleagues on this week's discussion board.
  7. Now you are ready to try the Build Your Site: Step-by-Step projects.
  8. In ASP 3, you'll build a true e-Commerce site with live database connectivity. Hope to see you then, and congratulations on progressing this far!

 

 

Module 4.3

 

Quiz 4.

Hint: All the answers are found on this page, but please still read Chapter Ten.

 

  1. Identify good error handling practices.
  2. What does the Scripting Object provide?
  3. The FileSystemObject Object may do what?
  4. The TextStream Object may do what?
  5. Which methods access the TextStream Object?