Ask a Question related to ASP, Design and Development.
-
Tom Bates #1
include files in global.asa?
Possible? It seems nobody knows how...
:-)
Tom
Tom Bates Guest
-
how do I hide database connection files using PHP include files?
I have the following at the beginning of the PHP page: <?php require_once('Connections/conn.php'); ?> I want to hide the connection file,... -
#26174 [Opn->Bgs]: Global vs. class vs. variable scope w/ include
ID: 26174 Updated by: alan_k@php.net Reported By: myle34 at hotmail dot com -Status: Open +Status: ... -
#26174 [NEW]: Global vs. class vs. variable scope w/ include
From: myle34 at hotmail dot com Operating system: Windows XP Home PHP version: 5.0.0b2 (beta2) PHP Bug Type: Variables... -
Problem with Include files - global.asa and other .asp scripts
Can I include the same include files in global.asa that I use in other ..asp scripts? I haven't been able to make it work. My O'Reilly book says... -
Global include implications :: relative vs physical :: local vs remote dev environement?
What is the best way to handle global includes for 3 subwebs that may at various times consume similiar include files such as ENQUIRY FORMS. I... -
Ken Schaefer #2
Re: include files in global.asa?
Why do you want to do that?
Cheers
Ken
"Tom Bates" <noneedto@email.me> wrote in message
news:4u9tlvc5f5ca1paamordam86gde6to3t1b@4ax.com...
: Possible? It seems nobody knows how...
:
: :-)
:
: Tom
Ken Schaefer Guest
-
Tom Bates #3
Re: include files in global.asa?
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"
<kenREMOVE@THISadOpenStatic.com> wrote:
>Why do you want to do that?
>
>Cheers
>Ken
>
>"Tom Bates" <noneedto@email.me> wrote in message
>news:4u9tlvc5f5ca1paamordam86gde6to3t1b@4ax.com.. .
>: Possible? It seems nobody knows how...
>:
>: :-)
>:
>: Tom
>Tom Bates Guest
-
Ken Schaefer #4
Re: include files in global.asa?
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" <noneedto@email.me> wrote in message
news:7p3ulv8v3o8u8vjvua1ftu66fpcci5iv12@4ax.com...
: 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"
: <kenREMOVE@THISadOpenStatic.com> wrote:
:
: >Why do you want to do that?
: >
: >Cheers
: >Ken
: >
: >"Tom Bates" <noneedto@email.me> wrote in message
: >news:4u9tlvc5f5ca1paamordam86gde6to3t1b@4ax.com.. .
: >: Possible? It seems nobody knows how...
: >:
: >: :-)
: >:
: >: Tom
: >
:
Ken Schaefer Guest
-
Tom Bates #5
Re: include files in global.asa?
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" -->
Tom Bates Guest



Reply With Quote

