microsoft.com Home  
Microsoft
http://www.microsoft.com/office/ork  
Microsoft Office 2000 Resource Kit Home
 Managing and Supporting Office 2000
 Ongoing Configuration of Office on Users' Computers
 Helping Users Help Themselves
Office 2000 Help and Support
Customizing Built-in Error Messages
Creating Your Own Help Topics
Linking the Answer Wizard to the Web
 Managing Security
 Overview of Tools and Utilities
Glossary
Index
Topic Contents
Next
Previous
Customizing Built-in Error Messages

How to Write the ASP Script for Custom Error Messages

When a user clicks the custom button in an error message box, an Active Server Pages (ASP) page responds by displaying the Web page you created to provide information about the error. The ASP page directs the request sent when the user clicks the custom error button in the error message box.

Tip   ASP pages are designed to run on the Microsoft Windows® operating system. For optimal performance, use Windows NT Server version 4.0 or later and Internet Information Server (IIS).

There are three ways to produce the ASP script. You can:

  • Use the ASP generator to create or update an ASP page

    This method is the quickest and easiest way to create an ASP page. However, it doesn’t allow complete customization and cannot handle large numbers of error messages. You need Excel 97 or later to use the ASP generator.

  • Modify the sample ASP script
  • This method requires knowledge of ASP scripting and Visual Basic Scripting Edition. It allows for both a quick start and complete customization. The sample script was created by using the file ASPscrpt.xls.
  • Write your own script

This method requires knowledge of ASP scripting and Visual Basic Scripting Edition. It allows for complete customization, but it requires development time.

Toolbox   The Office Resource Kit includes a file called ASPscrpt.xls to help you create your ASP script. Use this ASP generator to create the ASP file to handle your custom error messages. For information about installing this file, see Customizable Alerts.

Top

Create or update an ASP page

The quickest way to create an ASP page is to use the ASP generator (ASPscrpt.xls). The template requires information about each error message you are going to customize. After entering this information, you run the macro and it creates the ASP script for you.

To use the ASP generator, you need the following:

  • Excel 97 or later
  • A network computer configured as a Web server running Windows NT Server 4.0 with Service Pack 3 or Windows 2000 Server.
  • The ASP extensions that are included with Windows NT Server 4.0 with Service Pack 3 or included with the Windows NT Server 4.0 Option Pack installed on the network computer.

To generate an ASP file

  1. Start Excel, and open the file ASPscrpt.xls.
  2. In the Enter the default URL for error messages not listed below box, type the URL of the default Web page.

    The default Web page is a generic page used to handle all error messages that do not have a unique Web page assigned to them.

  3. In the Enter the physical, or actual, path of the base URL box, type the path to the destination directory where the new ASP file is stored.
  4. Fill in the Country Code, Microsoft Installer GUID, Error Message Number, and URL to the Destination Web Page columns for any error messages you want to customize.

    Be sure to specify the correct URL of the Web pages that you want to link to the custom error message box.

  5. Click Go.

    The new ASP file is created and stored at the location you specified.

Top

Modify the sample ASP script

You can also implement custom error messages by modifying a sample ASP script. The following ASP code from the sample file Alert.asp handles four custom printer-related error messages:

<% response.expires=0
alertNum=""&request.queryString("alrt")
LCID=request.queryString("HelpLCID")
GUID=request.queryString("GUID")

select case (alertNum & "GUID" & LCID)
case "197573{11111111-1111-1111-1111-111111111111}1033"
  response.redirect("http://helpdesk/office9alerts/printer.htm")
case "197574{11111111-1111-1111-1111-111111111111}1033"
  response.redirect("http://helpdesk/office9alerts/printer.htm")
case "197575{11111111-1111-1111-1111-111111111111}1033"
  response.redirect("http://helpdesk/office9alerts/printer.htm")
case "197576{11111111-1111-1111-1111-111111111111}1033"
  response.redirect("http://helpdesk/office9alerts/printer.htm")
case else
  response.redirect(http://helpdesk/office9alerts/FAQ.htm)
end select %>

To modify this sample script to work for your custom error messages, open the file in Microsoft FrontPage or another ASP editor and substitute the highlighted variables with your own values.

Toolbox   The Office Resource Kit includes sample ASP scripts and HTML files to help you create custom error messages. Create your own ASP scripts and HTML files based on the files Alert.asp, Alert.htm, Alert2.asp, Alert2a.asp, and NYI.htm. For information about installing these files, see Customizable Alerts.

The following values and variables are used in the sample ASP scripts:

Error Message ID   The number to the immediate right of the word case is the error message ID number.

GUID   The 32-character number to the right of the error ID number is the globally unique identifier (GUID). The ASP uses this number to determine which application to associate the error message with. There is only one GUID for each application.

Country Code   The number following the GUID is the country code. This number is used to identify the locale of Office 2000.

Response Redirect   This variable specifies the Web page associated with the error message.

All of the error messages in this sample script refer to the same Web page. You can easily assign different Web pages to each error by specifying other URLs. You can also add more error messages by repeating the case string.

Note   Two additional sample scripts, Alert2.asp and Alert2a.asp, provide examples of how you can extend the functionality of the ASP page. Alert2.asp prompts the user to enter an explanation of the problem that generated the error. After the user types their feedback and clicks Submit, they are redirected to Alert2a.asp which contains a message thanking them for their feedback.

Top

Write your own ASP page

You can write your own ASP page by using Visual Basic Scripting Edition or JavaScript, both of which are supported by Windows NT Server and IIS. When you write your own ASP page, you can add additional functionality beyond helping users out of an error message box. A custom ASP script can take the variables it receives from the custom error message and reuse the information in new contexts.

For example, a custom ASP script can generate dynamic HTML or redirect a browser to go to a different page, depending on the values sent to the ASP script from the browser. It can also capture the values from an error message and write them to a log file. A network administrator can use the log file to help solve common network problems.

Top

See also

You can use Visual Basic Scripting Edition or JavaScript to create your own ASP page. The IIS Web site contains links to a large number of additional resources that can help you to start working with these scripting languages, as well as reference information useful to more advanced scriptwriters. For more information, go to the Microsoft Windows NT Server Web Services site at http://www.microsoft.com/ntserver/web/.



Topic Contents   |   Previous   |   Next   |   Top

  Friday, March 5, 1999
© 1999 Microsoft Corporation. All rights reserved. Terms of use.

License