Microsoft KB Archive/302066

= Site Stager outputs ASP results on MCMS 2001 server =

Article ID: 302066

Article Last Modified on 4/9/2007

-

APPLIES TO


 * Microsoft Content Management Server 2001 Enterprise Edition
 * NCompass Resolution 4.0

-



This article was previously published under Q302066



SYMPTOMS
When the Microsoft Content Management Server (MCMS) 2001 Site Stager processes a posting that contains Active Server Pages (ASP) script, Site Stager outputs the results on the server that is running MCMS 2001. In other words, the ASP script is not in the staged site.



RESOLUTION
To resolve this problem, make sure that the staging process preserves the scripting code. To do this, use one of the following methods:   Wrap the code with the ASP logic (AutoSession.IsModeStaging) and use Response.Write to manually output the ASP scripting tags and codes. The following sample code tests to determine whether MCMS is running in Execution mode. If MCMS is in Staging mode, the code that is to be preserved during staging (as stored in the myscript variable) is written out, and will be in the staged site. If MCMS server is not in Staging mode, the code is run as usual.

Note This code sample assumes that you are running the VBScript engine on the server that is running Microsoft Internet Information Services (IIS). Dim strStaging Dim strDynamic

strStaging = &quot;Response.Write(&quot;&quot;The code I want&quot;&quot;)&quot; strDynamic = &quot;The code I want&quot;

If AutoSession.IsModeStaging Then Response.Write(&quot;<&quot; + &quot;%&quot; + strStaging + &quot;%&quot; + &quot;>&quot;) Else Response.Write strDynamic End If                     Wrap the code with the MCMS Site Stager staging tags. This is the recommended method because it automatically preserves all the ASP coding logic within the tag wrapper (so that the template designer does not have to write out &quot;<%&quot; manually with a separate Response.Write statement).

In the following sample code, MCMS Site Stager staging tags are used to stage ASP script. Any code that is between the STAGE_SCRIPT tags is staged without being parsed.

Note This code sample assumes that you are running the VBScript engine on the server that is running IIS. <% Response.Write &quot;The code I want&quot; %>

Everything that is between the tags is copied intact to the staged output. Because the content that is between the tags is not validated, you can put anything between the tags. 

Be aware of the following when you are using staged script:
 * The default scripting language of the template must be Microsoft Visual Basic Scripting Edition (VBScript) unless a script directive (such as %@LANGUAGE=JScript %>) appears at the top of the script.
 * If the staging tags are not specified correctly as shown in the product manual or the sample code that is presented in this article, they do not function correctly and the ASP scripts are not preserved in the staged output files.
 * The staged script should not access the MCMS 2001 Publishing API.
 * The default extension of the staged file is .asp unless you specify otherwise.
 * Staging tags and script that is to be staged cannot be nested inside a set of scripting delimiters.
 * You should enclose the script to be staged in a pair of scripting delimiters.



MORE INFORMATION
ASP script staging functionality is built in. However, you must enable it.

