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

Notes Section

Main Text

 

Module 1.0

 

 

 

 

 

Read VBScript 
User's Guide.

 





Reference also available entirely online.

 

Download and Install the VBScript Language Reference (VBSLR from hereon).

Note: If you are a former ASP 1 student, you may go directly to Exercise 1.

Go to msdn.microsoft.com/scripting/vbscript/default.htm with Internet Explorer (IE) 5+. Bookmark the site, visit all its VBScript links and read the VBScript User's Guide. Download and install VBSLR (VBSDOC.exe 473KB) msdn.microsoft.com/scripting/vbScript/download/vbsdown.htm#DOC following the download instructions. Read the other VBScript topics. You should already be familiar with terminology such as data types, operators, conditional statements and procedures from prior programming experience or classes; otherwise, you may have trouble with this class.

 

 

Module 1.1

 

 

 Sources for PWS 4.0:

 

-Windows 98

 

-Visual Studio 6 CD.

 

-MSDN Option Pack CD.

 

-Download (overnight).

 

Download the Personal Web Server 4.0 (PWS from hereon).

 

If downloading PWS overnight (may take up to four hours), go to www.microsoft.com/ntworkstation/downloads/Recommended/ServicePacks/

NT4OptPk/Default.asp and follow the directions.

 

PWS will be used to view your ASP scripts. It is your responsibility to successfully install PWS before the first class day. If you are unable, please use an Internet Information Server (IIS) web host to view your scripts. You may also use the IIS snap-in for Windows 2000.

 

This is an alternate, unofficial source for PWS,  www.download-safari.net/AllFiles/MicrosoftPersonalWebServer-30.html.

As a complement to the Personal Web Server (PWS)--not a replacement--you may want to publish your projects on this unendorsed free ASP web hosting site, http://www.brinkster.com/. Search the Web for others.

 

 

Module 1.2

 

Install PWS.

Please follow the directions on the download web site, the PWS installation wizard or in the course textbook.

 

Module 1.3

 

 

 

 

 

 

 

 

 

 


 
Course examples requiring a PWS name will be coded as localhost. You should replace your own PWS name in the code showing localhost.

 

Start Personal Web Manager.

1. Double click the PWS icon on the lower right corner of your monitor near the clock.

 

2. Notice that pressing the STOP button places a red “X” on the PWS icon and creates a START button which once pressed removes the “X”. This starts web services and makes certain pages in the wwwroot folder on your computer accessible to anyone with an Internet connection provided that you’re not behind a firewall, proxy server or other security feature.

 

3. Hyperlinked in the publishing frame is the name of your PWS. This name was created from your computer’s name. If your computer hadn’t been named, your PWS name will be http://localhost. You may change your PWS name by changing your computer’s name.

 

4. Select the Advanced icon. These advanced options are used to give directory-wide permissions for any browser to view a page. If the Allow Directory Browsing check box isn’t selected, the browser will display a directory listing denied message. We’ll work with these options later.

 

5. Selecting the Edit Properties button displays three types of permissions: Read, Execute and Script. Read permission is usually enabled to prevent a read access forbidden error message. Execute permission is typically disabled, because it allows any application in a directory including script engines to run. A directory with ASP scripts should be Script enabled, because unlike Execute you may cautiously limit the applications that run in the directory. We’ll work with these advanced options further in the first assignment.

 

 

Module 1.4

 

Create a Virtual Directory.

 

An alias for a file path on a server is termed a virtual directory, and it allows for the construction of a website independent of hard drive file structure. The advantages of a virtual directory are the separation of site layout from file path structure and the ability to shorten long URLs with the use of an alias, for example, http://acc/web/ host/class/part/one.asp may be replaced with the /part alias requiring the user to only type http://acc/part/one.aps.

 

1. Create a new folder named Part1 in the wwwroot folder created by PWS.

 

2. Start PWS > click Advanced > select  <Home>  > click Add > select the Part1 folder using Browse > type Part1 for the Alias > click OK keeping the default checkboxes (Read and Scripts should be toggled).

 

3. Open the Part1 folder in Windows Explorer > right click > New > Text Document > name it HelloEx1.asp > Yes (make certain the file has the .asp extension rather than the .txt extension.) In Windows Explorer, you may have to right click on the file and select Rename and manually add the .asp extension. Copy and paste the following text into HelloEx1.asp:

 

<HTML><HEAD><TITLE> HelloEx1</TITLE></HEAD><BODY>

Rather than writing <% Response.Write "Hello World!" %>

<BR><BR>My first ASP page will use a VBScript function on Internet Explorer to retrieve the date and time on the server. <BR><BR>The date is <% Response.Write Date %> on the server. The time is <%= Time %> on the server.

</BODY></HTML>

 

4. Save changes > type http://localhost/Part1/HelloEx1.asp into Internet Explorer where localhost is the name of your PWS. Please refer to Module section 1.3.3.

 

5. Notice:

 

  1. PWS uses the alias /Part1 for the file path C:\Inetpub\ wwwroot\Part1\HelloEx1.asp. You cannot enter this path directly in the browser.
  2. ASP code goes inside the server script delimiters, <%     %>.
  3. The shortcut for Response.Write is =.
  4. Text like Hello World! needs to be inside quotation marks “”, but a VBScript function like Date doesn’t. Don’t worry about the rest.

 

Module 1.5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 




ASP should be considered an application; therefore, ASPs are web applications and not web pages although they may output HTML, VBScript, JavaScript and web pages.

 

What is ASP?

 

A limitation of (enter word into textbox for definition) HTML is that it’s static. Developers need to employ client-side scripting (where the client is the web browser) like JavaScript, VBScripting Edition or JScript (Microsoft’s implementation of JavaScript) to make web pages dynamic (see also, Dynamic HTML). One disadvantage to client-side scripting is that it cannot carry information from one page to another. Server-side scripting like CGI, ISAPI, IDC (2) and ASP (2) addresses this restriction. ASP, however, is an improvement over CGI, ISAPI, IDC combining their advantages without their limitations.

 

Table 1.5.1. ASP combines the database access and programming ease of IDC, the robust operating system access of ISAPI or CGI and ISAPI’s speed. Third party developers may extend ASP with custom components. ASP is easier, faster to learn and more profuse than JSP. A newer and more powerful version of ASP called ASP+ (also called ASP.Net) will be available soon.

 

 

Advantage

Disadvantage

CGI

Powerful operating system access. Capabilites built into almost every server.

Difficult to maintain and debug. Taxes server resources sacrificing performance.

ISAPI

Powerful operating system access. Fast.

Must use complex languages like C/C++. Badly written programs may crash server.

IDC

Easily access and present database data to client.

Can’t add server side logic. Database programming only.

 

Because ASP pages may contain or create HTML, VBScript or JavaScript, it becomes difficult to define. As the next module will demonstrate, ASP can be best defined by where it runs: on the server.

 

 

Module 1.6

 

How Does ASP Work?

 

(1) Visiting web pages or clicking hyperlinks produce a HyperText Transfer Protocol (HTTP, see also SOAP) request by the browser. (2) As a result, the web server (please review link carefully; alternately, see server) sends the requested web pages with ASP script to the asp.dll which executes a text file called the global.asa containing information about the ASP application. (3) Then include files which support the ASP page are tied together, and (4) the ASP script moves to the script engine which creates any objects that may have been requested. (5) Next, the script engine interprets the script and send its instructions back to the asp.dll which (6) converts the information into HTML and sends it back to the browser.

 

Please refer to the index or the table of contents in the course textbook for more descriptions and diagrams on this topic.

 

 

Module 1.7

 

What Are Some ASP Web Servers and Editors?

 

If you do not have Microsoft’s Internet Information Server (IIS) which supports ASP, you may install ChiliASP or iASP which allows you to run ASP on Netscape or Unix web servers.

 

ASP and HTML may be edited in any text editor like NotePad (Start > Programs > Accessories > NotePad). Visual Interdev contains a set of convenient tools and utilites and is Microsoft’s preferred ASP editor. Others include FrontPage, Allaire’s Homesite, Macromedia’s UltraDev and the free (send a postcard) Edit Pad which is downloadable from www.tucows.com. (Do a Quick Search for the words Edit Pad.)

 

 

Module 1.8

Try out
http://validator.w3.org/

 


Bookmark this guide
http://werbach.com/barebones
/barebones.html

 


Define technical terms at

www.zdwebopedia.com

www.techweb.com/

encloypedia

 

Exercise 1.

1.    Introduce yourself to the class on the Week 1 Student Discussion Board and post a brief bio-sketch.

2.    Visit all the links shown on this lesson, and thoroughly review the VBScript Language Reference (VBSLR).

3.      Review your HTML by visiting all the links on this page.

4.   Then review HTML forms.

5.      Begin reading Appendix F, Forms and ASP, in the course textbook. Outline the material and paraphrase it in your own words.

6.      Work through the first three projects, RequestSniffer 01 - 03 in a new Part2 folder. See Module 1.4.1 for help creating a new folder in PWS.

7.   Discuss the correct answers to this week’s quiz (shown below) on the Week 1 Student Discussion Board.

8.      Use VBSLR to learn more about VBScript functions like those used in the HelloEx1.asp exercise. See Module 1.0. Review the IsDate, IsNull, IsNumeric, MsgBox, Trim and UCase fuctions.

 

Module 1.9

 

Quiz 1.

Note: Some questions should be familiar to former ASP 1 students. The first week is review for new students who haven't taken ASP 1.

 

  1. What is a virtual directory?
  2. Why is VBSLR a valuable resource for ASP developers?
  3. Of all the server-side scripting technologies like CGI, ISAPI, IDC, JSP, ASP and ASP+ (also known as ASP.Net) which is the newest?
  4. ASP runs on the server, but where in the server is the ASP script interpreted?
  5. What button value will display a “Critical Message” icon for the MsgBox function?