Microsoft KB Archive/308164

= HOW TO: Create and Configure Active Server Pages (ASP) Web Applications in Windows 2000 =

Article ID: 308164

Article Last Modified on 3/29/2007

-

APPLIES TO


 * Microsoft Windows 2000 Server
 * Microsoft Windows 2000 Advanced Server
 * Microsoft Windows 2000 Professional Edition
 * Microsoft Small Business Server 2000 Standard Edition
 * Microsoft Internet Information Services 5.0

-



This article was previously published under Q308164



IN THIS TASK
SUMMARY How to Create an ASP Web Application How to Configure an ASP Web Application Example of How to Create an ASP Application in a New Web Site
 * Step 1: Create a Content Directory
 * Step 2: Create an ASP Application
 * Step 3: Create a Web site
 * Step 4: Configure the ASP Application
 * Step 5: Test the ASP Application

REFERENCES



SUMMARY
This article describes how to create and configure Web applications in Internet Information Services (IIS) 5.0.

An IIS application is any file that is executed in a defined set of directories in your Web site. When you create an application, you designate the starting-point directory (also known as the &quot;application root&quot;) in your Web site. Each file or folder within the starting-point directory is considered as part of that application until another starting-point directory is created. You use directory boundaries to define the scope of a Web application.

In IIS 5.0, an application starting point is indicated by a &quot;package&quot; icon if it is created for a virtual directory or physical directory. If it is created for a Web site, the starting point is indicated by a &quot;globe in a hand&quot; icon.

back to the top

How to Create an ASP Web Application

 * 1) Click Start, point to Programs, point to Administrative Tools, and then click Internet Services Manager.
 * 2) Click to expand *  , where   is the name of the server.
 * 3) Right-click the directory that you want to use as the application starting point, and then click Properties.

NOTE: You can use the home directory of a Web site as the application starting point.
 * 1) In the   Properties dialog box (where   is the name of the directory that you selected), do one of the following:
 * 2) * If you selected a Web site, click the Home Directory tab.

-or-
 * 1) * If you selected a virtual directory, click the Virtual Directory tab.

-or-
 * 1) * If you selected a physical directory, click the Directory tab.
 * 2) Under Application Settings, click Create.

NOTE: If the Create button is not present, a default application has already been specified. In this case, click Remove to remove the default application, and then click Create.
 * 1) In the Application name box, type the name of the application that you want. Note that the application starting point is displayed next to Starting point.
 * 2) In the Execute Permissions list, click the level of permissions that you want to give this application. For example, for ASP scripts or Internet Database Connector (IDC) scripts, click Scripts only.

NOTE: The Scripts only option is more secure than the Scripts and Executables option.
 * 1) In the Application Protection list, click High (Isolated), and then click Apply.
 * 2) Click the Documents tab.
 * 3) If your application uses a default document that is not displayed in the document list, click Add.
 * 4) Type the name of the document in the Default Document Name box, and then click OK.
 * 5) Select the newly added document, and then click the up arrow button until the new document is at the top of the document list.

back to the top

How to Configure an ASP Web Application
Certain properties can be set for each ASP application that you have created. To configure an ASP application, follow these steps:
 * 1) Click Start, point to Programs, point to Administrative Tools, and then click Internet Services Manager.
 * 2) In the Internet Information Services window, click to expand *  , where   is the name of the server.
 * 3) Right-click the Web site or the starting-point directory of the application that you want, and then click Properties.
 * 4) Depending on the starting-point directory that you selected, click the Home Directory, Virtual Directory, or Directory tab.
 * 5) Under Application Settings, click Configuration, and then click the App Options tab.
 * 6) Click to select the Enable session state check box if you want ASP to create a session for each user who access an ASP application.
 * 7) Click to select the Enable buffering check box if you want ASP to collect all output that is generated by the ASP page before the output is sent to the requesting Web browser.
 * 8) Click to select the Enable parent paths check box if you want ASP to use relative paths to the parent directory of the current directory (paths using the .. syntax).

NOTE: If you enable this option, do not enable Execute permissions in the parent directories. This is to prevent a script in a subdirectory from running an unauthorized program in a parent directory.
 * 1) In the Default ASP language box, type the language that you want to use. This box specifies the language that is used to process commands within the ASP delimiters (<% and %>). Note that VBScript is the default ASP language.

NOTE: You can override the default language in your ASP page by using the <%@LANGUAGE%> directive.
 * 1) In the ASP Script timeout box, type the length of time that want the ASP to allow a script to run.

NOTE: You can set the timout period to a value between 1 and 2147483647.
 * 1) Click OK twice to save your changes and return to the Internet Information Services window.
 * 2) Quit IIS.

back to the top

Example of How to Create an ASP Application in a New Web Site
The following example illustrates how to create an ASP application in a new Web site in IIS.

NOTE: This example assumes the default installation of Windows 2000 on the drive C.

back to the top

Step 1: Create a Content Directory
 Start Windows Explorer, and then navigate to the following location:

C:\Inetpub

 On the File menu, point to New, and then click Folder. In the New Folder box, type Content, and then press ENTER. Quit Windows Explorer.

back to the top

Step 2: Create an ASP Application
 Start Windows Notepad.  In the Notepad window, type the following code: <HTML> <HEAD><TITLE>ASP Application</TITLE></HEAD> <BODY BGCOLOR=white> <H1>ASP Application</H1> <HR> Type your name <FORM METHOD=POST ACTION=Output.asp> <INPUT TYPE=TEXT NAME=&quot;username&quot;> <INPUT TYPE=SUBMIT> </FORM> </BODY> </HTML>

</li> On the File menu, click Save As.</li> In the Save As dialog box, navigate to Content in the Save in list, click All Files in the Save as type list, type Input.htm in the File name list, and then click Save.</li> On the Edit menu, click Select All, and then click Delete on the Edit menu.</li>  In the Notepad window, type the following code: <HTML> <HEAD><TITLE>ASP Application</TITLE></HEAD> <BODY BGCOLOR=white> <P>You typed:

<% NAME=REQUEST.FORM(&quot;username&quot;) RESPONSE.WRITE(NAME) %> </P> </BODY> </HTML> </li> On the File menu, click Save As.</li> In the Save As dialog box, click Content in the Save in list, click All Files in the Save as type list, type Output.asp in the File name list, and then click Save.

The ASP Content folder contains the Input.htm file and the Output.asp file.</li> Quit Notepad.</li></ol>

back to the top

Step 3: Create a Web site
 Click Start, point to Programs, point to Administrative Tools, and then click Internet Services Manager.</li> In the Internet Information Services window, click to expand * , where   is the name of the server.</li> Right-click Default Web Site, and then click Stop.</li> Right-click * , point to New, and then click Web Site.</li> After the Web Site Creation Wizard starts, click Next.</li> On the Web Site Description page, type Example in the Description box, and then click Next.</li> On the IP Address and Port Settings page, click Next.</li> <li>On the Web Site Home Directory page, type c:\inetpub\content in the Path box, and then click Next.</li> <li>On the Web Site Access Permissions page, verify that only the following check boxes are selected:

'''Read

Run scripts (such as ASP)'''

</li> <li>Click Next, and then click Finish.

The Example Web site is created and you are returned to the Internet Services Manager window.</li></ol>

back to the top

Step 4: Configure the ASP Application

 * 1) In the Internet Services Manager window, right-click Example, and then click Properties.
 * 2) Click the Home Directory tab.
 * 3) Under Application Settings, click Create.

NOTE: If the Create button is not present, a default application has already been specified. In this case, click Remove to remove the default application, and then click Create.
 * 1) Clear the contents of the Application name box, and then type, Example.
 * 2) Click the Documents tab, and then click Add.
 * 3) In the Default Document Name box, type Input.htm, and then click OK.
 * 4) In the document list, click Input.htm, and then click the up arrow button until Input.htm is at the top of the list.
 * 5) Click OK. You are returned to the Internet Information Services window.

back to the top

Step 5: Test the ASP Application
<ol> <li>Right-click Example, and then click Browse.</li> <li>The ASP Application page is displayed in the Web browser window.</li> <li>In the Type your name box, type your name, and then click Submit Query. A page similar to the following is displayed in the browser window, where  is the name that you typed:

You typed:

</li></ol>

To remove the Example Web site and restart the Default Web Site, follow these steps: <ul> <li>Remove Example Web site: <ol> <li>In the Internet Information Services window, right-click Example, click Delete, and then click Yes when the following message is displayed:

Are you sure you want to delete this item?

NOTE: This procedure does not remove the Content directory or the files that it contains.</li></ol> </li> <li>Restart Default Web Site:

Right-click Default Web Site, and then click Start. The Default Web Site is restarted.</li></ul>

back to the top

<div class="references_section">