Error message: HTTP: 500-100, Internal Server Error - ASP Error... Undefined Variable (257625)



The information in this article applies to:

  • Microsoft Internet Information Services 5.0

This article was previously published under Q257625

SYMPTOMS

When you attempt to browse an ASP Web page, the following error messages are displayed in the browser:
The page cannot be displayed
There is a problem with the page you are trying to reach and it cannot be displayed.
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
In addition, information similar to the following is displayed under the Technical Information (for support personnel) section:
Error Type:
Microsoft VBScript runtime (0x800A01F4)
Variable is undefined: 'x'
/OptionExplicitError.asp, line 9
Page:
GET /OptionExplicitError.asp

CAUSE

When you use Visual Basic, Scripting Edition, the Option Explicit statement is specified in the script of the ASP file. Subsequently, the script attempts to use an undeclared variable.

RESOLUTION

To resolve this issue, either remove the Option Explicit statement or declare the variable (using the DIM keyword).

MORE INFORMATION

Steps to reproduce the behavior

To reproduce this behavior, run an ASP file that contains the following code (in a virtual directory that permits script execution):
<% Option Explicit %>
<HTML>
<HEAD>
<TITLE>500-100 Undeclared Variable</TITLE>
</HEAD>
<BODY>
<P>About to use an undeclared variable</P>
<% 
  x = 5
%>
</B></P>
</BODY>
</HTML>
				
To fix the example above, declare the X variable using the DIM statement, which is demonstrated as follows:
<% Option Explicit %>
<HTML>
<HEAD>
<TITLE>500-100 Undeclared Variable</TITLE>
</HEAD>
<BODY>
<P>About to use an undeclared variable</P>
<% 
  DIM x
  x = 5
%>
</B></P>
</BODY>
</HTML>
				

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
(c) Microsoft Corporation 2000, All Rights Reserved. Contributions by Kevin Zollman, Microsoft Corporation.


Modification Type:MinorLast Reviewed:1/7/2006
Keywords:kbhttp500100 kbprb kbProd2Web KB257625