The Execute method allows you to call and execute an ASP script from within another ASP script. When the called script has finished executing, control returns to the ASP page that issued the Server.Execute method call. Using the Execute method, you can break complex applications down into modular, reusable components that can be called when needed. The Execute method is new to ASP 3.0/IIS 5.0.
The absolute or relative path to the ASP script you wish to execute. Only scripts within the current application's application space can be executed using this method.
In this example, the second script, which displays a text advertisement, is called (using the Execute method) by the first script only if the current user has not entered the "No Ad" club.
**** BEGIN ExecuteExamplePage.ASP ******** <HTML> <HEAD> <TITLE> Execute Example Form </TITLE> </HEAD> <BODY> <% ' This script executes an advertisement if the current ' user is not a member of the "No advertisement" club. ' Dimension Local variables. Dim blnNoAdClub ' Test Session variable. Session("blnNoAdClub") = False ' Set variables. blnNoAdClub = Session("blnNoAdClub") ' If the user belongs in the "No Ad" club don't show an ad. If Not(blnNoAdClub) Then
Server.Execute ("DisplayAdvertisement.asp")End If %> FROM HERE DOWN IS ALL CONTENT FROM ExecuteExampleForm.asp<BR> This page may or may not have an advertisement line at the top. </BODY> </HTML> **** END ExecuteExamplePage.ASP ...