Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > include files in global.asa?

Reply
Thread Tools

include files in global.asa?

 
 
Tom Bates
Guest
Posts: n/a
 
      09-10-2003
Possible? It seems nobody knows how...



Tom
 
Reply With Quote
 
 
 
 
Ken Schaefer
Guest
Posts: n/a
 
      09-10-2003
Why do you want to do that?

Cheers
Ken

"Tom Bates" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
: Possible? It seems nobody knows how...
:
:
:
: Tom


 
Reply With Quote
 
 
 
 
Tom Bates
Guest
Posts: n/a
 
      09-10-2003
I'd like to be able to do file cleanup in Session_OnEnd, and also have
the same logic available on-demand from an ASP page. It's all about
the code reuse, y'know?

Tom

On Wed, 10 Sep 2003 14:55:02 +1000, "Ken Schaefer"
<(E-Mail Removed)> wrote:

>Why do you want to do that?
>
>Cheers
>Ken
>
>"Tom Bates" <(E-Mail Removed)> wrote in message
>news:(E-Mail Removed).. .
>: Possible? It seems nobody knows how...
>:
>:
>:
>: Tom
>


 
Reply With Quote
 
Ken Schaefer
Guest
Posts: n/a
 
      09-10-2003
Call Session.Abandon in your "on demand" page, and Session_OnEnd will fire.
Then you can just centralise your code in the global.asa file.

Cheers
Ken

"Tom Bates" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
: I'd like to be able to do file cleanup in Session_OnEnd, and also have
: the same logic available on-demand from an ASP page. It's all about
: the code reuse, y'know?
:
: Tom
:
: On Wed, 10 Sep 2003 14:55:02 +1000, "Ken Schaefer"
: <(E-Mail Removed)> wrote:
:
: >Why do you want to do that?
: >
: >Cheers
: >Ken
: >
: >"Tom Bates" <(E-Mail Removed)> wrote in message
: >news:(E-Mail Removed).. .
: >: Possible? It seems nobody knows how...
: >:
: >:
: >:
: >: Tom
: >
:


 
Reply With Quote
 
Tom Bates
Guest
Posts: n/a
 
      09-10-2003
Well, I've finally gotten the answer I was looking for by crawling the
web some more. Here's what I've learned, in case someone else could
use this insight.

1. global.asa doesn't recognize <% and %> tags.
2. INCLUDE directives are HTML comments. So ASP has to be in HTML
parsing mode at the point where the include directive HTML comment
begins.
3. The parsing of ASP pages, including global.asa, starts out in HTML
mode, so you need <% (or <script> for global.asa) before code, and %>
(or </script> in global.asa) to get back to HTML parsing mode.
4. Subroutines at the beginning of global.asa are not handled
properly, so put them at the end.
5. option explicit comes before all code, including include files; if
used, include files must obey the explicit rule too; option explicit
can only be specified once, so don't put it in your include files

Here's what now works for me:

afunc.inc
---------
<%
function testit(b)
dim avar
avar = 1
testit = b + avar
end function
%>

apage.asp
---------
<% option explicit %>
<!-- #INCLUDE FILE="afunc.inc" -->
<%
dim t
( asp code )
t = testit(4)
%>

global.asa
----------
<script language="VBScript" runat="server">

option explicit

sub Application_OnStart
(VBscript)
end sub
sub Application_OnEnd
(VBscript)
end sub
sub Session_OnStart
(VBscript)
end sub
sub Session_OnEnd
dim what
(VBscript)
what = testit(11)
end sub

</script>
<!-- #INCLUDE FILE="afunc.inc" -->

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
#include headers that include this header Aguilar, James C++ 2 07-16-2004 05:56 PM
Re: the use of #include <a_file.h> v/s #include"a_file.cpp" Elie Nader C++ 1 11-28-2003 03:12 PM
Re: the use of #include <a_file.h> v/s #include"a_file.cpp" Rolf Magnus C++ 2 11-28-2003 12:26 PM
#include "bar" negates #include <string> ; how to fix? Danny Anderson C++ 5 08-15-2003 06:38 PM



Advertisments