ASP Vbscript Class Includes

M

mike

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
 
R

Ray at

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
 
H

Harag

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top