473,323 Members | 1,570 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

include files in global.asa?

Possible? It seems nobody knows how...

:-)

Tom
Jul 19 '05 #1
4 15811
Why do you want to do that?

Cheers
Ken

"Tom Bates" <no******@email.me> wrote in message
news:4u********************************@4ax.com...
: Possible? It seems nobody knows how...
:
: :-)
:
: Tom
Jul 19 '05 #2
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"
<ke*******@THISadOpenStatic.com> wrote:
Why do you want to do that?

Cheers
Ken

"Tom Bates" <no******@email.me> wrote in message
news:4u********************************@4ax.com.. .
: Possible? It seems nobody knows how...
:
: :-)
:
: Tom


Jul 19 '05 #3
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" <no******@email.me> wrote in message
news:7p********************************@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"
: <ke*******@THISadOpenStatic.com> wrote:
:
: >Why do you want to do that?
: >
: >Cheers
: >Ken
: >
: >"Tom Bates" <no******@email.me> wrote in message
: >news:4u********************************@4ax.com.. .
: >: Possible? It seems nobody knows how...
: >:
: >: :-)
: >:
: >: Tom
: >
:
Jul 19 '05 #4
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" -->

Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: JStrummer | last post by:
I have a question regarding paths and the include() statement in PHP. I develop in a Windows environment and will be publishing to a Linux server. I would like to do the following: 1. Setup my...
9
by: Tom Cat | last post by:
Is there anything wrong with using a lot of include files? On one part of my website, I have a form. The page it posts data to, includes a different file based on some of the values. The...
6
by: Tom | last post by:
I'm tying myself in knots trying to figure out variable scope with constants and include files. This is what I'm doing: A page (index.php) on my website includes a general purpose include file...
6
by: atv | last post by:
Alright, i have some questions concerning include files en global variables.I hope someone is willing to answer these. 1).Why is it that if i define a global variable in a file, say main.c, and...
44
by: Neil Cerutti | last post by:
In Rob Pike's style guide he urges the following: Simple rule: include files should never include include files. If instead they state (in comments or implicitly) what files they need...
5
by: David Mathog | last post by:
One thing that can make porting C code from one platform to another miserable is #include. In particular, the need to either place the path to an included file within the #include statement or to...
14
by: Wescotte | last post by:
I have an application that uses several file formats for similar data. So I've created various php files for each format containing the same functions which produce the same end result. Now I...
6
by: Royan | last post by:
Ok the problem is quite hard to explain, but i'll try to keep it as simple as i can. Imagine I have the following structure of my files and folders: /root/global.inc |__/files/foo.php...
4
by: Hua.watson | last post by:
I want to add some declaration intio my namespace. But I do not have the right to modify proto header files. So I try namespace mynamespace{ #include "a.h" #include "b.h" }
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.