Basic Questions about Global.asa from a beginner

Discussion in 'ASP General' started by Mukesh_Singh_Nick@yahoo.com, Sep 17, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. Evertjan. Guest

    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)
     
    Evertjan., Sep 17, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Darlene Gauthier

    PostRequestHandlerExecute event in global.asa

    Darlene Gauthier, Jul 23, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,440
    Karl Seguin
    Jul 23, 2003
  2. Kevin Spencer

    Re: global.asa file (count sessions)

    Kevin Spencer, Jul 30, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    358
    Kevin Spencer
    Jul 30, 2003
  3. Wayne
    Replies:
    2
    Views:
    485
    Wayne
    Nov 11, 2003
  4. Sathyaish

    Basic beginner questions

    Sathyaish, Dec 27, 2006, in forum: Java
    Replies:
    8
    Views:
    335
  5. Lasse Edsvik

    basic global.asa thingy

    Lasse Edsvik, Nov 5, 2003, in forum: ASP General
    Replies:
    2
    Views:
    113
    Randy Rahbar
    Nov 5, 2003
Loading...

Share This Page