1. Include files dynamically
You should use FileSystemObject to achieve this.

<%

Dim objFS,otf
Set objFS = CreateObject(“Scripting.FileSystemObject”)
Set otf = objFS.OpenTextFile(server.mappath(“/include/filename.asp”),
1, False)
response.write otf.readall
otf.Close
set fs=nothing

%>

Tip :You can not include files as follows.

<%
If case=1 then%> 
<!--include file="file1.asp"--> 
else 
<!--include
file="file1.asp"--> 
End
if %>


Back to code snippet home…

* Macronimous.com does not use information collected in this form for any marketing purposes. Check our privacy policy here.

Related Scripts

Database values to List Box

Database values to List Box

1. Database value to List Box Open a database, Connect it, retrieve the values with sql and populate the Listbox with them. <% set objConn=server.createobject(“adodb.connection”)

Show server variables

Show server variables

1. Show server variables This script displays all the server variables in a tabled format. <table width=”70%” align=”center”> <tr bgcolor=”#FF9900″> <td width=”25%”> <div align=”center”><font size=”2″><b><font