473,783 Members | 2,545 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

include files in global.asa?

Possible? It seems nobody knows how...

:-)

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

Cheers
Ken

"Tom Bates" <no******@email .me> wrote in message
news:4u******** *************** *********@4ax.c om...
: 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*******@THIS adOpenStatic.co m> 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.c om...
: 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*******@THIS adOpenStatic.co m> 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="VBScr ipt" runat="server">

option explicit

sub Application_OnS tart
(VBscript)
end sub
sub Application_OnE nd
(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
4669
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 include references in such a way that I don't have to change them all every time I have to publish to the production server 2. Setup above in such a way that won't involve php.ini (& LInux equivalent), as I have access to edit this file...
9
2322
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 include files also include other pages based on different values. All of these work together to select the right information from the database and display it in the correct format. I'm just wondering if it is better to put all the code in one file...
6
3390
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 (ini.inc) that declares a constant DAY_NUM. A little later in the file, ini.inc includes another file (b_data.inc) that tries to use DAY_NUM. I'm getting a "Use of Undefined Constant" notice as a result of this line when I load index.php in the...
6
9580
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 i have also other functions defined in that file, i can use the global in all functions, but once i split up the rest of the function in other files, i cannot use the global? Isn't that strange, all the files compiled should be treated as one...
44
3415
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 to have included first, the problem of deciding which files to include is pushed to the user (programmer) but in a way that's easy to handle and that, by construction, avoids multiple inclusions. I was startled by this guideline, since...
5
2512
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 very carefully define the order in which paths are searched with command line options on the compiler. Both can cause problems, especially when dealing with complex software distributions. It occurs ot me that by extending the C include...
14
3743
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 currently have a functions setup that just reads a file and determines which file type it is and includes the correct source. My goal is add a new function to each source called My_File_Format($filename) where each file checks to see if the...
6
2498
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 |__/utils |__/logs/logger.inc When I run foo.php I get the following error:
4
2146
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
9643
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9480
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10083
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9946
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5379
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3645
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.