Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

include files in global.asa file?

568 views
Skip to first unread message

Craig Buchanan

unread,
Jan 4, 2000, 3:00:00 AM1/4/00
to
Is there a way to reference a .inc file in a .asa file? I have developed
code libraries that are kept in .inc files (plain text) that I want to
reference in the global.asa file. Using the <!-- #include
file="library.inc" --> tag causes an error. Is there another way?

--
Sincerely,

Craig Buchanan, President
Cogniza, Inc.
www.cogniza.com
news.cogniza.com
+1.612.824.5858

Aaron Bertrand

unread,
Jan 4, 2000, 3:00:00 AM1/4/00
to
Sure you can. Just make sure you use <script> tags, and put the include
file OUTSIDE of them, e.g.:

<!--#include file="library.inc"-->
<script language="vbscript" runat="server">
sub session on_start
' ...blah blah
</script>

--
ab/mvp

"Craig Buchanan" <cra...@hotmail.com> wrote in message
news:#UHKQEvV$GA.254@cppssbbsa04...

Craig Buchanan

unread,
Jan 4, 2000, 3:00:00 AM1/4/00
to
Unfortunately, I get this error:

Active Server Pages error 'ASP 0137'

Invalid Global Script

/oracle/node.inc, line 1

Script blocks must be one of the allowed Global.asa procedures. Script
directives within <% ... %> are not allowed within the global.asa file. The
allowed procedure names are Application_OnStart, Application_OnEnd,
Session_OnStart, or Session_OnEnd.

I have scripts included in the .inc files. Perhaps this is what is
objectionable.

Sincerely,

Craig Buchanan, President
Cogniza, Inc.
www.cogniza.com
news.cogniza.com
+1.612.824.5858


Aaron Bertrand <send_spam...@my-deja.com> wrote in message
news:OuAqtUvV$GA.262@cppssbbsa05...

Jesse E. Smith

unread,
Jan 4, 2000, 3:00:00 AM1/4/00
to
My apologies in advance for posting JavaScript to a VBScript group.

On IIS4 using JavaScript, I'm successfully doing this by using a script
block inside the include file instead of <% %>. For example, the include
file utility.inc looks like:

<SCRIPT LANGUAGE=JavaScript RUNAT=Server>
function utilityFunction() {...
... several other functions ...
</SCRIPT>

Then, the global.asa looks like Mr. Bertrand has suggested:

<!--#INCLUDE FILE="include/utility.inc" -->
<SCRIPT LANGUAGE=JavaScript RUNAT=Server>
function Session_OnStart() {
utilityFunction();
...
</SCRIPT>

I haven't tried this with VBScript, but I would think that it would work the
same. I'm not sure that it would work if there was any script in the
include file that wasn't inside of a function or subroutine.

HTH,
Jesse

"Craig Buchanan" <cra...@hotmail.com> wrote in message

news:uA7uvevV$GA.261@cppssbbsa04...

Aaron Bertrand

unread,
Jan 4, 2000, 3:00:00 AM1/4/00
to
Oh yes, your include file must be functions only, not perform any actual
code unless called upon, and be included within <script> tags (NOT <%%>).

--
ab/mvp

Craig Buchanan

unread,
Jan 4, 2000, 3:00:00 AM1/4/00
to
Jesse-

Thanks that worked. I had to remove all the "<%" and "%>" tags from my .inc
file and ensure that the <SCRIPT> tags were there as well.

Craig

Craig Buchanan, President
Cogniza, Inc.
www.cogniza.com
news.cogniza.com
+1.612.824.5858

Jesse E. Smith <jesse...@ieee.org> wrote in message
news:e5GOd1vV$GA.62@cppssbbsa04...


> My apologies in advance for posting JavaScript to a VBScript group.
>
> On IIS4 using JavaScript, I'm successfully doing this by using a script
> block inside the include file instead of <% %>. For example, the include
> file utility.inc looks like:
>
> <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
> function utilityFunction() {...
> ... several other functions ...
> </SCRIPT>
>
> Then, the global.asa looks like Mr. Bertrand has suggested:
>
> <!--#INCLUDE FILE="include/utility.inc" -->
> <SCRIPT LANGUAGE=JavaScript RUNAT=Server>
> function Session_OnStart() {
> utilityFunction();
> ...
> </SCRIPT>
>
> I haven't tried this with VBScript, but I would think that it would work
the
> same. I'm not sure that it would work if there was any script in the
> include file that wasn't inside of a function or subroutine.
>
> HTH,
> Jesse
>
> "Craig Buchanan" <cra...@hotmail.com> wrote in message
> news:uA7uvevV$GA.261@cppssbbsa04...

> > Unfortunately, I get this error:
> >
> > Active Server Pages error 'ASP 0137'
> >
> > Invalid Global Script
> >
> > /oracle/node.inc, line 1
> >
> > Script blocks must be one of the allowed Global.asa procedures. Script
> > directives within <% ... %> are not allowed within the global.asa file.
> The
> > allowed procedure names are Application_OnStart, Application_OnEnd,
> > Session_OnStart, or Session_OnEnd.
> >
> > I have scripts included in the .inc files. Perhaps this is what is
> > objectionable.
> >

0 new messages