There is a vast difference between Server.Execute and
this:-
<%
if status=1 then %>
<!-- #include file="status_1.asp" -->
<%
else %>
<!-- #include file="status_else.asp" -->
<%
end if
'proceed with the rest of the code
'upon receiving value from include asp page
%>
1. Prior to IIS 5, there was no other way to conditionally execute an Include. However, the drawback was that every include referenced in the conditionality is loaded which in the code above is BOTH status_1.asp and status_else.asp. This meant that if the status_1.asp has 1,000 lines of code and status_else.asp has another 1,000 lines of code, we have 2,000 lines of code being loaded even though we will only execute one of the two includes. You can extrapolate and imagine if you have 5 or more includes. This made scalability a joke on IIS if you implement conditionality on includes. Recap: ALL INCLUDES WOULD BE LOADED/INITIALISED. ONLY ONE WOULD BE EXECUTED!
2. Server.Execute provided the best of both worlds; No loading/initialising of ALL includes. Just the execution of the asp page we want. That is why Server.Execute was created in IIS 5 and which should be used over the old way of conditionality. Server.Execute means that the ASP page concerned would be executed and then control would be passed back to the original page. All items in the Response Object is available in the executed page as well.
Regards,
Brandon Driesen
Main Topics
Browse All Topics





by: munish123Posted on 2001-12-26 at 21:26:16ID: 6695683
On the IIS 5.0 Server.execute and include serve the same purpose, however server.execute is the preffered way.
If you have the IIS vervion 4 then the Server.execute method won't work and you have to use the include directive only...