167 lines
6.5 KiB
HTML
167 lines
6.5 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||
<HTML>
|
||
<HEAD>
|
||
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
|
||
<TITLE>Execute</TITLE>
|
||
<SCRIPT LANGUAGE="JavaScript">
|
||
<!--
|
||
TempString = navigator.appVersion
|
||
if (navigator.appName == "Microsoft Internet Explorer"){
|
||
// Check to see if browser is Microsoft
|
||
if (TempString.indexOf ("4.") >= 0){
|
||
// Check to see if it is IE 4
|
||
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
||
}
|
||
else {
|
||
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
||
}
|
||
}
|
||
else if (navigator.appName == "Netscape") {
|
||
// Check to see if browser is Netscape
|
||
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
|
||
}
|
||
else
|
||
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
|
||
//-->
|
||
</script>
|
||
<SCRIPT LANGUAGE="VBScript">
|
||
<!--
|
||
Sub Window_OnLoad()
|
||
Dim frmContents
|
||
On Error Resume Next
|
||
If Not Parent Is Nothing Then
|
||
Set frmContents = Parent.Contents
|
||
If Not frmContents Is Nothing Then
|
||
frmContents.Window.TOCSynch_Click
|
||
End If
|
||
End If
|
||
End Sub
|
||
//--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
|
||
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
|
||
<META NAME="MS.LOCALE" CONTENT="EN-US">
|
||
<META NAME="MS-IT-LOC" Content="Internet Information Services">
|
||
</HEAD>
|
||
|
||
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
|
||
|
||
<H4><A NAME="_execute"></A><SUP></SUP>Execute</H4>
|
||
|
||
<P>The <B>Execute</B> method calls an .asp file and processes it as if it were part of the calling ASP script. The <B>Execute</B> method is similar to a procedure call in many programming languages. </P>
|
||
|
||
<H6>Syntax</H6>
|
||
|
||
<P><B>Server.Execute( </B><I>Path </I><B>)</B></P>
|
||
|
||
<P> </P>
|
||
|
||
<H6>Parameters</H6>
|
||
|
||
<DL>
|
||
<DT><I>Path</I></DT>
|
||
|
||
<DD>A string specifying the location of the .asp file to execute. The <I>Path</I> parameter may be for either an absolute or a relative path. If the <I>Path</I> is absolute, it must map to an ASP script in the same application as the calling .asp file. <I>Path</I> can be a string variable name that is set at run-time. The <I>Path</I> parameter must not contain a query string or IIS returns an error.</DD>
|
||
</DL>
|
||
|
||
<H6>Remarks</H6>
|
||
|
||
<P>The <B>Server.Execute</B> method provides a way of dividing a complex application into individual modules. By employing the <B>Server.Execute</B> method, you can develop a library of .asp files that you can call as needed. This approach is an alternative to server-side includes. The major difference is that you can dynamically call an .asp file with <B>Server.Execute</B>.</P>
|
||
|
||
<P>After IIS processes the .asp file specified in the input parameter to <B>Server.Execute</B>, the response is returned to the calling ASP script.</P>
|
||
|
||
<P>Collections and properties available to the executed .asp page are:
|
||
|
||
<UL type=disc>
|
||
<LI>Application variables, even if they are set in the calling page.</li>
|
||
|
||
<LI>Session properties, even if they are set in the calling page.</li>
|
||
|
||
<LI>Server variables and properties, even if they are set in the calling page.</li>
|
||
|
||
<LI>Request collections and properties, even if they are set in the calling page. This includes Form and QueryString data passed to the calling page.</li>
|
||
|
||
<LI>Response collections and properties. The executed .asp file may modify HTTP headers. However, as with any .asp file, if the executed .asp file attempts to modify HTTP headers after it sends a response to the client, it will generate an error.</li>
|
||
</UL>
|
||
|
||
<P>If a file is included in the calling page with #include, the executed .asp will not see it. For example, you may have a subroutine in a file that is included in your calling page, but the executed .asp will not recognize the subroutine name. You must include the file in each executed .asp that requires the subroutine.</P>
|
||
|
||
<P>If either the calling or called .asp file contains a transaction directive, the status of the transaction will apply to the .asp file that contains the directive. For example, if ASP1 below calls ASP2 and the transaction is aborted while ASP2 is being processed, ASP2's <B>OnTransactionAbort</B> (if present) will be called. After ASP2 completes processing, ASP1's <B>OnTransactionAbort</B> (if present) will be called.</P>
|
||
|
||
<PRE><CODE>ASP1:
|
||
<%@ Transaction=Required %>
|
||
<%
|
||
Server.Execute ("ASP2.asp")
|
||
Sub OnTransactionAbort
|
||
Sub OnTransactionCommit
|
||
%>
|
||
|
||
ASP2.asp:
|
||
<%@ Transaction=Required %>
|
||
<%
|
||
Sub OnTransactionAbort
|
||
Sub OnTransactionCommit
|
||
%>
|
||
</CODE></PRE>
|
||
|
||
<H6>Example</H6>
|
||
|
||
<P>In the following example, the browser language determines which .asp file is executed. The output from these scripts on a US system is:</P>
|
||
|
||
<P>Company Name</P>
|
||
|
||
<P>Welcome to my website!</P>
|
||
|
||
<P>The output from these scripts on a German system is:</P>
|
||
|
||
<P>Company Name</P>
|
||
|
||
<P>Willkommen zu meinem website!</P>
|
||
|
||
<P>The output from these scripts on a Spanish system is:</P>
|
||
|
||
<P>Company Name</P>
|
||
|
||
<P>Recepci<EFBFBD>n a mi website!</P>
|
||
|
||
<P>(Languages with multi-byte characters have not been included in this example because CodePage incompatibilities.)</P>
|
||
|
||
<P><B>Welcome.asp</B></P>
|
||
|
||
<PRE><CODE><HTML>
|
||
<BODY>
|
||
<H1>Company Name</H1>
|
||
<%
|
||
AcceptLang = Request.ServerVariables("HTTP_ACCEPT_LANGUAGE")
|
||
Lang = Left(AcceptLang, 2)
|
||
Server.Execute(Lang & "Welcome.asp")
|
||
%>
|
||
</BODY>
|
||
</HTML>
|
||
</CODE></PRE>
|
||
|
||
<P><B>enWelcome.asp</B></P>
|
||
|
||
<PRE><CODE><% Response.Write "Welcome to my website!" %>
|
||
</CODE></PRE>
|
||
|
||
<P><B>deWelcome.asp</B></P>
|
||
|
||
<PRE><CODE><% Response.Write "Willkommen zu meinem website!" %>
|
||
</CODE></PRE>
|
||
|
||
<P><B>esWelcome.asp</B></P>
|
||
|
||
<PRE><CODE><% Response.Write "Recepci<63>n a mi website!" %>
|
||
</CODE></PRE>
|
||
|
||
<H6>Applies to</H6>
|
||
|
||
<P><A HREF="/iishelp/iis/htm/asp/vbob7838.htm"><B>Server</B> Object</A></P>
|
||
|
||
<H6>See Also</H6>
|
||
|
||
<P><A HREF="/iishelp/iis/htm/asp/vbob9waa.htm"><B>Transfer</B></A>, <A HREF="/iishelp/iis/htm/asp/vbob7z78.htm"><B>OnTransactionAbort</B></A>, <A HREF="/iishelp/iis/htm/asp/vbob1n04.htm"><B>OnTransactionCommit</B></A></P>
|
||
<hr class="iis" size="1">
|
||
<p align="center"><em><a href="../../../common/colegal.htm">© 1997-2001 Microsoft Corporation. All rights reserved.</a></em></p>
|
||
</BODY>
|
||
</HTML>
|