Error Variable is undefined - ASP Errors
DescriptionCurrent variable has not being declared yet, before being used for its first time.
Error Variable is undefined
It is not a particularly critical error.
This message informs us that we are trying to use a variable without having declared it previously.
ASP, by default, does not oblige to declare the variables before using them, as, during the interpretation phase, the webserver automatically provides to identify all the variables used inside the code in order to allocate the necessary space for them.
In any case, it is good habit to get used to declare any variable before its use.
A declared variable improves the elaboration performance of the page and it allows to edit errors when calling non defined values.
How to Fix the Error
This error is only sent back in the case where the compulsory declaration was forced, through the Option Explicit instruction inserted at the beginning of the page.
To correct the error it is enough to define the variable before using it, through the
Dim statement, as follows
where variablename is the variable we are dealing with.
It is recommended to always work with forced declaration property turned on as it will help the programmer to produce a safer, more efficient and performing code.