Hi, I'm running into a problem with VBSCRIPT classes in ASP.

I use a seperate file for each class I use. Some of these class files
are included in multiple ASP scripts, but are also included in other
include files. So if you can't see the problem already, it is that
occasionally the class file will be included twice in the same script,
relsulting in the following error:

Microsoft VBScript compilation error '800a0411'

Name redefined

/includes/classes/closableobjectlist.asp, line 2

Class ClosableObjectList
------^

Does anyone know a clean solution for this problem?
Right now I am just having to be really careful with my includes, but
if there was a way I could protect against this, I believe it would be
a much more user friendly solution.

Thank You
Mike Biang
Senior Web Application Developer
Cramer Development

Re: ASP Vbscript Class Includes by Ray

Ray
Wed Aug 11 10:27:03 CDT 2004

Don't nest includes, as a general practice, and you should be okay. There
isn't a programming solution, only a programmer solution, and that is to do
things carefully!

Ray at work

"mike" <mbiang@rockisu.com> wrote in message
news:8d00393f.0408110700.504bb80e@posting.google.com...
> Hi, I'm running into a problem with VBSCRIPT classes in ASP.
>
> I use a seperate file for each class I use. Some of these class files
> are included in multiple ASP scripts, but are also included in other
> include files. So if you can't see the problem already, it is that
> occasionally the class file will be included twice in the same script,
> relsulting in the following error:
>
> Microsoft VBScript compilation error '800a0411'
>
> Name redefined
>
> /includes/classes/closableobjectlist.asp, line 2
>
> Class ClosableObjectList
> ------^
>
> Does anyone know a clean solution for this problem?
> Right now I am just having to be really careful with my includes, but
> if there was a way I could protect against this, I believe it would be
> a much more user friendly solution.
>
> Thank You
> Mike Biang
> Senior Web Application Developer
> Cramer Development



Re: ASP Vbscript Class Includes by Harag

Harag
Wed Aug 11 10:56:00 CDT 2004

On 11 Aug 2004 08:00:20 -0700, mbiang@rockisu.com (mike) wrote:

>Hi, I'm running into a problem with VBSCRIPT classes in ASP.
>
>I use a seperate file for each class I use. Some of these class files
>are included in multiple ASP scripts, but are also included in other
>include files. So if you can't see the problem already, it is that
>occasionally the class file will be included twice in the same script,
>relsulting in the following error:
>
>Microsoft VBScript compilation error '800a0411'
>
>Name redefined
>
>/includes/classes/closableobjectlist.asp, line 2
>
>Class ClosableObjectList
>------^
>
>Does anyone know a clean solution for this problem?
>Right now I am just having to be really careful with my includes, but
>if there was a way I could protect against this, I believe it would be
>a much more user friendly solution.
>
>Thank You
>Mike Biang
>Senior Web Application Developer
>Cramer Development



The safest way IMHO is to NOT include them in the included files and
put a note at the top of the included files that if the included file
is included into a asp file then you will also need file
clsMyClass.asp included as well.

Try and keep your include files as function/sub files (rather than
pure HTML (ie menu) code) then call the sub "displayMenu" from each
.ASP page.

HTH

Al.