Introduction to ASP


What Is ASP?

Microsoft Active Server Pages (ASP) is a server-side scripting environment that you can use to create and run dynamic, interactive Web server applications. With ASP, you can combine HTML pages, script commands, and COM components to create interactive Web pages or powerful Web-based applications, which are easy to develop and modify. For example, you can use the ActiveX Data Objects (ADO) components to add database connectivity to your Web pages.


How ASP Works

When you incorporate ASP into your Web site, here's what happens:

  1. The user brings up a Web site where the default page has the extension .asp.
  2. The browser requests the ASP file from the Web server.
  3. The server-side script begins to run with ASP.
  4. ASP processes the requested file sequentially (top-down), executes any script commands contained in the file, and produces an HTML Web page.
  5. The Web page is sent to the browser.

Because your script runs on the server, the Web server does all of the processing and standard HTML pages can be generated and sent to the browser. This means that your Web pages are limited only by what your Web server supports.


Internet Information Services (IIS)

To run ASP on your computer you will need the Internet Information Services (IIS) component installed on your machine.

IIS is a web server application and set of feature extension modules created by Microsoft for use with Microsoft Windows. IIS is not turned on by default when Windows is installed.

Read Internet Information Services for more information.

Creating Virtual Directories in IIS

In most cases, the content you publish to your Web or FTP site is located in a root or home directory on your computer, such as C:\Inetpub\wwwroot\. However, there might be instances when the content is located somewhere else, or even on a remote computer.

To publish from any directory not contained within your home or root directory, you can create a virtual directory. A virtual directory is a directory that is not contained in the home directory but appears to client browsers as though it were.

You can create a virtual directory through IIS Manager or by using Windows Explorer.

Important: You must be a member of the Administrators group on the local computer to perform the following procedures.

To create a virtual directory by using IIS Manager

  1. In IIS Manager, expand the local computer, expand the Web Sites folder, right-click the site or folder within which you want to create the virtual directory, point to New, and then click Virtual Directory. The Virtual Directory Creation Wizard appears.


  2. Click Next.

  3. In the Alias box, type a name for the virtual directory. (Choose a short name that is easy to type because the user types this name.)

  4. Click Next.

  5. In the Path box, type or browse to the physical directory in which the virtual directory resides, and then click Next.

    Note: This path is the root of your ASP Web application.

  6. Under Allow the following permissions, select the check boxes for the access permissions you want to assign to your users, you must select Read and Run scripts, and then click Next.

  7. Click Finish. The virtual directory under the default website is created at the selected folder and is displayed in the IIS manager.

    Note that the virtual directory setup as an ASP application is displayed with a icon. (The screenshot is from Windows 2003 server. The icon may be different in other versions of Windows.) Remember that this is the root of your ASP application. (If the virtual directory is not an ASP application, it is displayed with a icon, the application root for scripts under this directory will be an upper level virtual directory or website setup as ASP application.)

    Right-click the Virtual Directory and then click Properties. If the virtual directory is an ASP application, the application root is displayed in the [Local path] textbox and the button next to [Application name] will be displayed as [Remove]. Otherwise, the button will be displayed as [Create] and you can click to make the virtual directory an application.

    For real websites, e.g. if you use Web hosting, the application root is usually setup at the root of the website. For local IIS website during development, the application root is usually a virtual directory under the Default Web Site.

    IIS properties

  8. (Optional) If you use the iTextSharp extension (for PDF Export) and/or the AspNetResize extension (for image resize), ASP.NET must be installed and enabled on your server. Click the ASP.NET tab and choose ASP.NET 2.0 (or higher) as ASP.NET version.

To create a virtual directory by using Windows Explorer

  1. Open Windows Explorer.

  2. Right-click the folder you want to be a virtual directory, and click Sharing and Security.

  3. Click the Web Sharing tab.

  4. Click Share this folder.

  5. In the Alias box, type the name for the virtual directory.

  6. Click OK twice.

Creating Virtual Directories in IIS 7 (Windows Vista or Later)

The IIS manager user interface consists of three panes.

The left hand side pane is Connections, the middle pane is Workspace and the right hand side pane is Actions.

The Connections pane lists application pools and websites. The workspace pane consists of two tabs at the bottom namely Features View and Content View. The Features View allows you to work with the settings of the selected item from Connections pane whereas the Content View displays all the child nodes (content) of the selected item.

Application pool is a group of IIS applications that are isolated from other application pools. Each application pool runs in its own worker process. Any problem with that process affects the applications residing in it and not the rest of the applications. You can configure application pools individually.

In order to create a new application pool, select "Application Pools" under Connections pane. Then click on "Add application pool" from Actions pane. This will open a dialog as shown below:

Specify a name for the new pool to be created. Select .NET framework version that all the applications from the pool will use. Also select pipeline mode. There are two pipeline modes viz. integrated and classic. The integrated mode uses the integrated request processing model whereas the classic mode uses the older request processing model. Click OK to create the application pool.

Your new application pool will now be displayed in the Workspace pane. To configure the application pool click on the "Advanced Settings" option under Actions pane. The following figure shows many of the configurable properties of an application pool.

If you use 64-bit Windows, set Enable 32-Bit Applications to True. (See Running Classic ASP on 64-bit Windows Operating System below.)

To create a new web site, select Web Sites node under Connections pane and then click on "Add Web Site" under Actions pane. This opens a dialog as shown below:

Here, you can specify properties of the new web site including its application pool and physical location.

Creating an IIS application or a Virtual Directory is quick and simple. Just right click on the web site and choose either "Add Application" or "Add Virtual Directory" to open respective dialogs (see below).

An existing Virtual directory can be marked as an IIS application by right clicking on it and selecting "Convert to Application".

Once you create a website or an IIS application, you can then set several ASP related configuration properties via Workspace pane.

Go to ASP->Debugging Properties->Send Errors to Browser, set it to True,

You may encounter the following error messages when you run ASP pages with IIS 7:

1. Error message when you request an ASP page that connects to an Access database in IIS 7.0: "Microsoft JET Database Engine error '80004005'"


2. Error message when you request an ASP page: "An error occurred on the server when processing the URL. Please contact the system administrator"

Go to Internet Options->Advanced, disable "Show friendly HTTP error messages".



Configuring Permissions

An important aspect of working with an Access .mdb file and files on the Web server is to correctly configure permissions.

When a Web application uses an Access database, the application must have Read permission to the .mdb file so the application can access the data. Additionally, the application must have Write permission to the folder that contains the .mdb file. Write permission is required because Access creates an additional file that has the extension .ldb in which it maintains information about database locks for concurrent users. The .ldb file is created at run time.

By default, the anonymous IIS user is IUSR_<MachineName>. Therefore, to use an Access database in an ASP Web application, you must configure the folder that contains the Access database to have both Read and Write permissions for the IUSR_<MachineName> user account.

If you specify database path, ASPMaker also creates the database folder but you may need to set the permissions yourself. To set permissions in the database folder,

  1. In Windows Explorer, move to the root folder for the Web site. e.g. C:\Inetpub\wwwroot\ExampleSite.
  2. If the database folder does not already exist, create one.
  3. Right-click the database folder, click Properties, and then click the Security tab.

  4. Under Group or user names, look for IUSR_<MachineName>.
  5. Verify that the account has Read and Write permissions for the database folder.

Similarly, set permissions in the file folder where the uploaded files and temporary files reside.

If you use the iTextSharp extension (for PDF Export) and/or the AspNetResize extension (for image resize), note that ASP.NET Web applications run in the context of a local machine account named ASPNET (for Windows 2000 and Windows XP) or in the context of the account NETWORK SERVICE (for Windows Server 2003 or later). To read/write temporary files, you must configure the file folder (see ASP Settings) to have both Read and Write permissions for the ASP.NET user account.


Running Classic ASP on 64-bit Windows Operating System

Windows Server 2008 64-bit (IIS 7)

On 64-bit Windows 2008, IIS 7 can run both 32-bit and 64-bit worker processes simultaneously. To run 32-bit Web applications in IIS 7 on 64-bit Windows 2008 all it needs is to assign the 32-bit applications to a separate application pool in IIS and turn on the Enable 32-Bit Applications switch for that application pool. To do this, open IIS Manager, open Application Pool, select the application pool, and then click Advanced Settings. In Enable 32-Bit Applications, select True.

Windows Server 2003 64-bit (IIS 6)

On 64-bit Windows 2003, although IIS 6 supports running both 64-bit and 32-bit worker processes, it doesn't support running in both modes simultaneously. By default IIS 6 is configured to run in native 64-bit mode and work only with 64-bit worker processes, which means you can only run 64-bit Web applications (for ASP.NET applications they can only target ASP.NET version 2.0 or higher) in the native mode. In order to run 32-bit Web applications you will need to set IIS 6 to run in 32-bit mode. Note: This means all your Web applications will now run in 32-bit mode.

To enable IIS 6 to run 32-bit worker processes follow these steps:

  1. Open a command prompt and navigate to the %systemdrive%\Inetpub\AdminScripts directory
  2. Type the following command:
    cscript.exe adsutil.vbs set W3SVC/AppPools/Enable32BitAppOnWin64 "true"
  3. Press ENTER
  4. Afterwards restart IIS by using the iisreset command from the command-line

The following article explains the details of the changes in the behavior of IIS after configuring it to run 32-bit worker processes: Running 32-bit Applications on 64-bit Windows (IIS 6.0)


Also See:

Application Root


 ©2006-2017 e.World Technology Ltd. All rights reserved.