[thelist] Need Server-Side ASP script

Ken Schaefer ken at adOpenStatic.com
Mon Dec 1 19:49:59 CST 2003


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Sam Carter" <scforum at iness.com>
Subject: [thelist] Need Server-Side ASP script


: I need to implement a server - side "include" function in ASP
: which will calculate a filename, then include the selected file
: into the HTML source code.
:
: Does anyone have a good example script that will read a
: specified file name and write it to the HTML output?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#includes are processed before any ASP script is processed, so your proposed
solution that won't work directly.

Instead, you can use the FileSystemObject to open the text file from disk,
and then Response.Write() the contents to the response stream.

However, don't expect performance to be very good. It may be better to use a
database for this? Or, if it's for a templating type scenario, it may be
better to look at ASP.Net and either page class properties or dynamically
loaded user controls.

Cheers
Ken

Microsoft MVP - Windows Server (IIS)



More information about the thelist mailing list