[thelist] [ASP] Server.Execute vs. #include

Jacques Capesius jacques_capesius at cnt.com
Tue Dec 31 11:31:01 CST 2002

Hi folks,

I was discussing ASP best practices with a fellow nerd and I posted him a
question that he didn't have an answer for, so I thought I'd run it by you
wizards to wrap your heads around.

How does Server.Execute work?

The reason I ask, is that I know that when you include the line...

<!--#include file="IncludePages/includeThisfile.asp"-->

...IIS grabs the code of the file being included and shoves it, inline, into
the existing ASP document, then processes the entire thing. It doesn't do it
conditionally, just looks for all include files before doing any of the
if/then processing for example. I think there are many ASP programmers out
there who think they can make a program smaller and hence require IIS to do
less processessing by writing a code sample like..

If Request.Form("theaction") = "DeleteForm" then
	%><!--#include file="IncludePages/DeleteForm.asp"--><%
ElseIf Request.Form("theaction") = "UpdateForm" then
	%><!--#include file="IncludePages/UpdateForm.asp"--><%
End If

...under the false notion that IIS will process the If/Then statement, then
include the appropriate file depending on which if/then rings true, which,
as described above, isn't the case.

Can you achieve this conditional document inclusion with the following line
of code?

If Request.Form("theaction") = "DeleteForm" then
	Server.Execute ("IncludePages/DeleteForm.asp")
ElseIf Request.Form("theaction") = "UpdateForm" then
	Server.Execute ("IncludePages/DeleteForm.asp")
End If

Any of your thoughts would be greatly appreciated.

-jacques :)

Jacques Capesius
CNT Web Marketing Developer
jacques_capesius at cnt.com
(763) 268-6749

More information about the thelist mailing list