Active Server Corner
Quick Site Search
What's Inside
Home
Activity
Books
Excerpts
In-Depth
CodeLibrary
Columns
ActiveTalk
COMSutra
Cornered!
My 3 Cents
Square ONE
Downloads
Events
FAQ's
Jobs
Search
Tools
Product Reviews
Tutorials
Site Info
About Us
Advertising Info
Contact Us
Privacy Policy
Terms of Use
Write for Us
  Book Excerpts  

Troubleshooting IIS 4.0 and Visual InterDev 6.0

by Ken Spencer
Published by 29th StreetPress
Dec.98; $24.95US; 1-58304-029-3
148 pages

Chapter 2 Using Active Server Pages (ASP) and HTML

INTRODUCTION AND TABLE OF CONTENTS Page 1: APPLICATION AND SESSION VARIABLES Page 2: USING THE VISUAL INTERDEV 6.0 SCRIPT DEBUGGER Page 3: SCRIPTING

Checklist

The ASP Processor

  • Application and Session Variable
    • Using the Visual InterDev 6.0 Script Debugger
  • Scripting
    • Using the IIS Namespace and Isolated Mode


Using ASP and HTML
Active Server Pages (ASP) gives IIS 4.0 its ability to execute script-based applications. ASP is implemented by its own processor and scripting engines. IIS 4.0 also has the ability to read and transmit HyperText Markup Language (HTML) files.

The ASP Processor

IIS 4.0 executes ASP by using the Asp.dll to process the text files containing ASP code. When a request for a page with an extension associated with ASP is received, IIS calls the Asp.dll to process the file. The ASP processor then calls in a script engine, such as VBScript, to compile and execute the script in each page.

Note By default, the extension for the ASP is .asp.

APPLICATION AND SESSION VARIABLES

Application variables and session variables are used to store information on the server in an ASP application. IIS 3.0 and ASP introduced application variables and session variables, which are valuable in constructing Web-based applications. The ASP stores session variables as part of a user's session object and makes these variables available at any point in the Web application, but only for the duration of the user's session. ASP stores application variables as part of the application object and makes these variables available at any point in the Web application.

Several factors can cause application and session variables to be unavailable in an application. They range from simple settings in the IIS 4.0 Microsoft Management Console (MMC) to changes that you can make in Visual InterDev 6.0 to programming settings in the application. Some of the most common causes for unavailability and their solutions follow.

Problem: .htm pages may not be mapped to Asp.dll.
The IIS 4.0 default application mappings will execute the Asp.dll for .asp pages only. If a user first enters a site via an htm page, then Asp.dll does not execute, Global.asa does not execute, and ASP functionality is not available.

Solution: Map.htm pages to Asp.dll.
To map the pages,

  1. Start the IIS 4.0 MMC.
  2. Select the application you wish to change and display its Property pages.
  3. Click the Configuration button in the Application Settings section.
  4. Click the App Mappings tab (Figure 2.1).
  5. Enter a new entry for .htm files that matches the .asp entry.

Tip Edit the ASP entry, then copy it for the .htm page


  1. Close the Properties pages to complete the change.

Problem: Session variables may not be enabled.
You can enable and disable session variables for each application and for each ASP page.

Solution 1: Enable session state for an application with the IIS 4.0 MMC.
To enable session state with IIS 4.0 MMC,

  1. Start the IIS 4.0 MMC.
  2. Select the application you want to change and display its Property pages.
  3. Click Configuration in the Application Settings section.
  4. Click the App Options tab (Figure 2.2).
  5. Check the Enable session state checkbox. (You can also change the session timeout value by entering a new number in the Session timeout box.)
  6. Close the Properties pages to complete the change.

Solution 2: Enable session state for an application via Visual InterDev 6 0.
To enable session state using Visual InterDev 6.0,

  1. Start Visual InterDev 6.0.
  2. Open the project you want to change.
  3. Right-click the project name in Project Explorer and select properties from the shortcut menu.
  4. Click the Editor Defaults tab (Figure 2.3).
  5. Click the Enable session state checkbox to allow session state for the application.
  6. Close the properties pages to complete the change.

Problem: Session variables may be programmatically disabled.
Developers can use a server-side script directive to disable session variables.

Solution 1: Enable session variables via the directive line at the beginning of ASP pages.
Change the ASP pages to use sessions by inserting the following code in the directive line at the start of each page:

Enablesessionstate=True

Solution 2: Enable session variables with Visual InterDev 6.0.
To enable session variables using Visual InterDev,

  1. Open the project you wish to change.
  2. Right-click the page name in Project Explorer and select Properties from the shortcut menu.
  3. Click the Enable session state checkbox to allow session state for the page.
  4. Close the Properties pages to complete the change.

INTRODUCTION AND TABLE OF CONTENTS Page 1: APPLICATION AND SESSION VARIABLES Page 2: USING THE VISUAL INTERDEV 6.0 SCRIPT DEBUGGER Page 3: SCRIPTING

Copyright © 1999 Ken Spencer






Copyright © 1997-2000 Active Server Corner. All rights reserved.

Sponsored by Coastline Web Hosting in Santa Barbara, California