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
|
|
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,
- Start the IIS 4.0 MMC.
- Select the application you wish to change and display its Property pages.
- Click the Configuration button in the Application Settings section.
- Click the App Mappings tab (Figure 2.1).
- Enter a new entry for .htm files that matches the .asp entry.
Tip Edit the ASP entry, then copy it
for the .htm page
- 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,
- Start the IIS 4.0 MMC.
- Select the application you want to change and display its Property pages.
- Click Configuration in the Application Settings section.
- Click the App Options tab (Figure 2.2).
- Check the Enable session state checkbox. (You can also change the session timeout value
by entering a new number in the Session timeout box.)
- 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,
- Start Visual InterDev 6.0.
- Open the project you want to change.
- Right-click the project name in Project Explorer and select properties from the shortcut
menu.
- Click the Editor Defaults tab (Figure 2.3).
- Click the Enable session state checkbox to allow session state for the application.
- 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,
- Open the project you wish to change.
- Right-click the page name in Project Explorer and select Properties from the shortcut
menu.
- Click the Enable session state checkbox to allow session state for the page.
- Close the Properties pages to complete the change.
Copyright © 1999 Ken Spencer
|