Dynamic Includes   
 
ASP does not support dynamic includes (variable) by <!--#include--> tag. But if the included file is clear-text (or HTML), you can use FileSystemObject and next code to include the file :
<%
    FileName = Server.MapPath(Request.QueryString("include"))
    Response.Write CreateObject("Scripting.FileSystemObject").OpenTextFile _
        (FileName, 1, False, False).readall
%>
    And then you can call the ASP : http://server/thefile.asp?include=myinclude.htm
    Be sure that the client can read only allowed files (the code enables read all text files on the server !).
You can use Select Case :
<%
    FileName = Server.MapPath(Request.QueryString("include"))
    Select Case LCase(FileName)
       Case "file1.htm", "file2.htm" : FileName = FileName
       Case Else : FileName = "AccessDenied.htm"
    End Select
%>


My3C's
perrychicker
It's easy... it's a PSACAKE!
Back | Tell A Friend | Search this Site
© 1998 - 2008 psacake.com
Version 3.23

Send me One Million FREE Guaranteed Visitors