Public SUB and FUNCTION in GLOBAL.ASA for rest of ASP pages to use?

Discussion in 'ASP General' started by Noozer, Jul 19, 2005.

  1. Noozer

    Noozer Guest

    Can I create a Function or Sub in my GLOBAL.ASA file for all pages of my
    application to use? If not, how does one do this?

    For example, I have an "IIF" function since it isn't natively implemented in
    ASP. Currently I have an Include directive on every page that includes the
    scripting for this function. I'd rather just declare it once, globally.

    '--- Provide IIF functionality to ASP -------------------------------
    Function IIF(eval, trueVal, falseVal)
    if (eval) then
    IIF=trueVal
    else
    IIF=falseVal
    end if
    End Function

    Thx!
     
    Noozer, Jul 19, 2005
    #1
    1. Advertising

  2. Sadly, no, you cannot do this. You have to continue doing what you're
    doing, basically.

    Ray at work

    "Noozer" <> wrote in message
    news:CU1De.1982318$6l.1516499@pd7tw2no...
    > Can I create a Function or Sub in my GLOBAL.ASA file for all pages of my
    > application to use? If not, how does one do this?
    >
    > For example, I have an "IIF" function since it isn't natively implemented

    in
    > ASP. Currently I have an Include directive on every page that includes the
    > scripting for this function. I'd rather just declare it once, globally.
    >
    > '--- Provide IIF functionality to ASP -------------------------------
    > Function IIF(eval, trueVal, falseVal)
    > if (eval) then
    > IIF=trueVal
    > else
    > IIF=falseVal
    > end if
    > End Function
    >
    > Thx!
    >
    >
     
    Ray Costanzo [MVP], Jul 19, 2005
    #2
    1. Advertising

  3. Noozer wrote:
    > Can I create a Function or Sub in my GLOBAL.ASA file for all pages of
    > my application to use? If not, how does one do this?
    >
    > For example, I have an "IIF" function since it isn't natively
    > implemented in ASP. Currently I have an Include directive on every
    > page that includes the scripting for this function. I'd rather just
    > declare it once, globally.
    >
    > '--- Provide IIF functionality to ASP -------------------------------
    > Function IIF(eval, trueVal, falseVal)



    Other than creating a dll with a type library (so you can use a META tag in
    global.asa to reference it) containing your custom functions, you're pretty
    much stuck with using include files.

    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Jul 19, 2005
    #3
  4. Noozer

    Noozer Guest

    "Bob Barrows [MVP]" <> wrote in message
    news:...
    > Noozer wrote:
    >> Can I create a Function or Sub in my GLOBAL.ASA file for all pages of
    >> my application to use? If not, how does one do this?
    >>
    >> For example, I have an "IIF" function since it isn't natively
    >> implemented in ASP. Currently I have an Include directive on every
    >> page that includes the scripting for this function. I'd rather just
    >> declare it once, globally.
    >>
    >> '--- Provide IIF functionality to ASP -------------------------------
    >> Function IIF(eval, trueVal, falseVal)

    >
    >
    > Other than creating a dll with a type library (so you can use a META tag
    > in
    > global.asa to reference it) containing your custom functions, you're
    > pretty
    > much stuck with using include files.


    Thanks... this at least would allow me to build a common library for things
    I use often. I'll do some searching.

    Do you have any "howto" sites offhand that would point me in the right
    direction? (or any reasons that I wouldn't want to do this?)
     
    Noozer, Jul 19, 2005
    #4
    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. Charles A. Lackman
    Replies:
    1
    Views:
    1,402
    smith
    Dec 8, 2004
  2. SpamProof
    Replies:
    0
    Views:
    603
    SpamProof
    Oct 21, 2003
  3. Wayne
    Replies:
    2
    Views:
    485
    Wayne
    Nov 11, 2003
  4. Ben
    Replies:
    2
    Views:
    920
  5. Prabhat

    Sub Procedure in Global.asa

    Prabhat, Oct 6, 2005, in forum: ASP General
    Replies:
    2
    Views:
    121
    Prabhat
    Oct 6, 2005
Loading...

Share This Page