Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Basic Questions about Global.asa from a beginner

Reply
Thread Tools

Basic Questions about Global.asa from a beginner

 
 
Mukesh_Singh_Nick@yahoo.com
Guest
Posts: n/a
 
      09-17-2006
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

 
Reply With Quote
 
 
 
 
Evertjan.
Guest
Posts: n/a
 
      09-17-2006
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)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginner's Beginner william nelson Ruby 7 04-11-2011 11:23 PM
Basic beginner questions Sathyaish Java 8 02-24-2007 04:46 AM
Very basic beginner question (I hope) Chele Sedai ASP .Net 8 03-14-2005 06:55 PM
No Class at ALL!!! beginner/beginner question =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?= ASP .Net 7 02-03-2005 02:47 PM
Tutorial for beginner/ Tutorial voor beginner Rensjuh C++ 7 09-02-2004 12:41 AM



Advertisments