Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 824313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:05:01+00:00 2026-05-15T03:05:01+00:00

Does ASP Classic have a feature that is the equivalent of PHP’s include once

  • 0

Does ASP Classic have a feature that is the equivalent of PHP’s “include once” feature?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T03:05:02+00:00Added an answer on May 15, 2026 at 3:05 am

    I know this is an old topic, but I thought I’d add my two cents in case anyone’s interested.

    I wrote a function that does precisely what you want: includes the given file exactly one no matter how many times it was called.

    class ImportFunction
        private libraries_
        private fso_
    
        private sub CLASS_INITIALIZE
            set libraries_ = Server.createObject("Scripting.Dictionary")
            set fso_ = Server.createObject("Scripting.FileSystemObject")
        end sub
    
        public default property get func (path)
            if not libraries_.exists(path) then
    
                on error resume next
                with fso_.openTextFile(path)
                    executeGlobal .readAll
                    if Err.number <> 0 then 
                        Response.write "Error importing library "
                        Response.write path & "<br>"
                        Response.write Err.source & ": " & Err.description
                    end if
                end with
                on error goto 0
    
                libraries_.add path, null
            end if
        end property
    end class
    dim import: set import = new ImportFunction
    

    Notes:

    • This uses a faux function simulated with a default property. If this bothers you, it’s easily refactored.
    • The dictionary must be persistent through all includes, whereas persisting the fso merely avoids reconstructing it. If you don’t like the idea of keeping them around after the imports are done, you could modify the class to get syntax like this:

      with new Importer
          .import "foo"
          .import "bar/baz"
      end with
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anyone know what does that error mean? I have just copied my ASP classic
We have a classic ASP application that simply works and we have been loathe
I have a large classic ASP app that I have to maintain, and I
Does visual studio 2008 support classic asp development? It's been years since I created
We are trying to make big decisions about our support for classic asp. Does
Should I learn NHaml ? What does it provide me over a classic ASP.NET
Does ASP.NET MVC have anything like the RESTful out-of-the-box features like Ruby on Rails
Does ASP.NET MVC provide a standard validator functionality or do you have to create
Just to preface: I work in a small company that does ASP.NET development and
Does Server Core 2008 support asp.net? I see references online saying that it isn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.