Forum Moderators: open
This is from "my bible" I understand it but haven't yet used it as I do not have IIS5 to test (well not on my server.)
SSI's are used to insert code from another page into the current one. All SSI are carried out before any ASP code is executed, this means that if you want to use your ASP code to determine what file to include, you CAN'T.But You can (with correct version of IIS) use Server.Execute(path). this executes the ASP script specified by (path).
If (path) is an absolute path it should be for as ASP page within the same application space (i.e. same folder or one of its subfolders). (path may contain query string data)
I typed it out as written, because I can't take credit for this info ;)
I'll be experimenting later too ;)
Suzy
The only incorrect point from your quote is that server.execute *doesn't* allow you to point it at a script name which includes query string information...
e.g. the following doesn't work under IIS 5.1 (if you remove the query string it works like a charm);
server.execute( "/page2.asp?bob=1" )
Another answer for the more traditional coder would be to encapsulate the code inside the include, including it at the start and then calling it later on.
This has the advantage of working under all IIS versions plus you ensure that the code inside the include doesn't expose unnecessary variables or constants, and you gain the advantage of having reasonably neat looking code (is it just me or do we all want the code to look nice?).
<!--#include file="includedfile.asp"-->
<%
CODE
CODE
CODE'Trip the include code on demand
MyIncludeFunction()CODE
CODE
CODE
%>
- Tony