ALP Server.Execute method
Executes another page, script or other module and places its output in the output stream of the page. 


Server.Execute( url )


url - string containing the virtual or relative path to the other resource/page

Usually this method is used with parameters pointing to another page in the same site/application. However in ALP it is possible to call this method with external URL - for example online WEB page or even other namespace (such as mk: for a page from help file etc.). Warning: using external URL is not guaranteed to work correctly on Windows 95.



<% Server.Execute("/adverts/placeadverts.asp?count=2") %>

Suppose the page referred above places several adverts and the count parameter tells the page how many adverts to generate. The output will be put in the place where the call to the method appears.

<% Server.Execute("/pages/page.html") %>

Places the page.html into the output. When using statements like this note that the non-body elements of the page will not be stripped and if the page is not especially designed for the purpose (e.g. saved with HEAD, HTML and BODY tags removed) the output may be corrupted by the appearance of these tags. Internet Explorer deals in very intelligent manner with such situations but in most cases the executed pages are especially designed for usage through the Server.Execute method.


Like in the #include directive, Server.MapPath the Execute method accepts relative or virtual paths. A relative path is a path resolved upon the location of the currently displayed page and virtual path is path resolved upon the root of the site (the closest parent directory containing an file). So:


is a relative path


is a virtual path

Usage of ../ is accepted but not recommended as it is often source of human mistakes when moving the pages across the site. 


You can pass a parameter like http://server/path/page.asp to this method. Do not forget that this will require internet connection and may slow down the page execution drastically (because it cannot be displayed until the requested page is fetched from the internet). If you need to perform such operations take care to place them in separate parts of your application and inform the user about the requirements of these pages. Also note that IIS does NOT support external URL and such pages will not be compatible with it.

Applies to: Server object

newObjects Copyright 2001-2006 newObjects [ ]