I, as like most ASP developers have wanted the
ability to dynamically include script files. If dynamic includes were possible
we would be able to increase performance if existing code, add files based upon
a variable value and even change the structure of page creation. The
possibilities are enormous.
The function is actually very simple. It reads
the passed file using the filesystem object. Then it removes the surrounding ASP
delimiters "<% ... %>". This allows us to re-use existing files. The files
contents are then passed through the vbscript method "ExecuteGlobal". This will
stick the content into the current process and give us access to it. Below is an
example of how to include a file.
I made this version fairly simple. You can not
include files with HTML. It will only recognize the surrounding ASP delimiters
"<% ... %>". Version 2 which will be posted here in a couple days will take care
of that problem.
I really hope that you find this as useful as I
have. Since this is so unique I would very much appreciate that you recognize
where you got it. I would appreciate any comments or suggestions for future
version to increase performance and robustness. I would also appreciate you
See Version 2