472,142 Members | 1,324 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Basic Questions about Global.asa from a beginner

I am learning classic ASP 3.0. Below are my questions:

1. Do we have to include (<!-- #include FILE="global.asa" -->) the
global.asa file into every .asp page? I am doing the examples in
Windows Notepad and not in DreamWeaver or InterDev. Or, does IIS
automatically associate global.asa, if one is present in the
application folder, with the pages in that folder?

2. Can we write other global functions that we intend to use accross
pages in an application in the global.asa file? I have done so but when
I call the method in a login.asp page, I get a TypeMismatch.

For e.g in login.asp

<%
Response.Write(CallMe())
Response.End
%>

In global.asa

Sub Application_onStart()
End Sub
....
.....etc. (application and session events)

Public Function CallMe()
CallMe = "Did you just call me?"
End Sub

Sep 17 '06 #1
1 2333
wrote on 17 sep 2006 in microsoft.public.inetserver.asp.general:
I am learning classic ASP 3.0. Below are my questions:

1. Do we have to include (<!-- #include FILE="global.asa" -->)
No, it wouldn't even run.
the
global.asa file into every .asp page? I am doing the examples in
Windows Notepad and not in DreamWeaver or InterDev.
Very good, using a text editor is the best way to learn ASP, HTML and
other code.
Or, does IIS
automatically associate global.asa, if one is present in the
application folder, with the pages in that folder?
No.

global.asa runs only when the ASP application starts, restarts, or when
the apication sees that it is changed.

So global.asa does not run at the beginning of a session!

However session_nstart is invoked at every session start.
2. Can we write other global functions that we intend to use accross
pages in an application in the global.asa file?
No, global.asa only lets you set application variables and session
variables.
I have done so but when
I call the method in a login.asp page, I get a TypeMismatch.

For e.g in login.asp

<%
Response.Write(CallMe())
unnecesary () if you use vbscript.
Response.End
%>

In global.asa

Sub Application_onStart()
End Sub
...
....etc. (application and session events)

Public Function CallMe()
CallMe = "Did you just call me?"
End Sub
So you knew this already ;-{

Try:

Sub Application_onStart()
application("CallMe") = "Did you just call me?"
End Sub

<%
Response.Write application("CallMe")
Response.End
%>

=============

If you want to have standard functions present on your pages,
include them:

<!-- #include virtual="/myLibrary/myFunctionsInclude.asp" -->

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Sep 17 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by abisofile | last post: by
15 posts views Thread by Pelle Beckman | last post: by
4 posts views Thread by Ramesh | last post: by
2 posts views Thread by Fay Yocum | last post: by
3 posts views Thread by JJ | last post: by

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.