include files in global.asa?

Ask a Question related to ASP, Design and Development.

  1. #1

    Default include files in global.asa?

    Possible? It seems nobody knows how...

    :-)

    Tom
    Tom Bates Guest

  2. Similar Questions and Discussions

    1. 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,...
    2. #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: ...
    3. #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...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

  6. #5

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139