Condividi tramite


#config

The #config Server-Side Include (SSI) directive specifies the string to be used for SSI error messages, and the format to be used for dates and file sizes returned by the #flastmod and #fsize SSI directives. You must surround a directive with HTML comment delimiters.

By default, this directive can be used only in STM pages; it cannot be used in ASP pages. To perform these tasks by using ASP scripting, you can use the FileSystemObject object, which is documented by the Windows Script Technologies Web site in the Microsoft Visual Basic? Scripting Edition (VBScript) or Microsoft JScript? sections.

Syntax

<!-- #config Output = String -->

Parameters

  • Output
    Specifies the output to be formatted. The output can be one of the following:

    Output

    Meaning

    ERRMSG

    Overrides the error message returned to the client browser if an error occurs during the processing of an SSI directive. By default, an SSI error message provides debugging information that details exactly what went wrong. To override the default error message, provide a short, simple error message in the String parameter. For example,

    <!-- #config ERRMSG="An SSI error has occurred." -->

    To restore the default error message, call the directive with an empty string. For example,

    <!-- #config ERRMSG="" -->

    The maximum length of the String parameter is 1024 bytes.

    TIMEFMT

    Specifies the format in which dates should be returned to the client browser with the #flastmod directive. The String parameter specifies the format. You can extract individual portions of the date, such as the day of the week or the month, by using formatting tokens in String. (The formatting tokens are the same as those you would use for the ANSI C strftime function).

    The time and date functions below use the language set with the C library locale rather than the operating system locale. The C library locale is usually set to English.

    %a Abbreviated name for day of the week (for example, Mon).

    %A Complete name for day of the week (for example, Monday).

    %b Abbreviated month name (for example, Feb).

    %B Complete month name (for example, February).

    %c Date and time representation that is appropriate for the C locale (for example, 05/06/01 12:51:32).

    %d Day of the month as a decimal number (01?31)

    %H Hour in 24-hour format (00-23).

    %I Hour in 12-hour format (01?12).

    %j Day of the year as a decimal number (001?366).

    %m Month as a decimal number (01?12).

    %M Minute as a decimal number (00?59).

    %p Current C locale's A.M. or P.M. indicator for 12-hour format (for example, PM).

    %S Second as a decimal number (00?59).

    %U Week of the year as a decimal number, with Sunday as the first day of the week (00?51).

    %w Day of the week as a decimal number, with Sunday as the first day (0?6).

    %W Week of the year as a decimal number, with Monday as the first day of the week (00?51).

    %x Date representation for the current C locale (for example, 05/06/01).

    %X Time representation for the current C locale (for example, 12:51:32).

    %y Year without the century as a decimal number (for example, 01).

    %Y Year with the century as a decimal number (for example, 2001).

    %z, %Z Time-zone name or abbreviation; no characters if time zone is unknown.

    %% Percent sign.

    SIZEFMT

    Configures the output of the #fsize directive to display the file size in kilobytes or bytes. The String parameter can have one of two values: "ABBREV" displays file size in kilobytes, and "BYTES" displays file size in bytes.

  • String
    The error message string that you want to display. This string has a maximum size of 1024 bytes.

Remarks

The file containing this directive must use a file name extension that is mapped to the SSI interpreter; otherwise, the Web server will not process the directive. By default, the file name extensions .stm, .shtm, and .shtml are mapped to the SSI interpreter (ssinc.dll).

An STM page using this directive must be run by itself or by calling it from an ASP page by using Response.Redirect. Calling an STM page from an ASP page with Server.Transfer, Server.Execute, or #include will not work because that would force the STM page to go through Asp.dll instead of through Ssinc.dll.

If you have the IIS Manager installed, you can modify default extension mappings and add new mappings; . Because you cannot map a file name extension to more than one executable, you cannot use thisdirective in ASP files. ASP files are already mapped to Asp.dll and must stay that way.

--- SSI.stm ---

<!-- #config ERRMSG = "An error occurred processing a directive." --> 



SSI.stm was last formatted on  
<!-- #config TIMEFMT = "%A, the %d of %B, %Y, at %H:%M" --> 
<!-- #flastmod FILE = "ssi.stm" --> 
<BR> 

The size of SSI.stm in bytes is 
<!-- #config SIZEFMT = "BYTES" --> 
<!-- #fsize FILE = "ssi.stm" --> 
<BR><BR> 

This line will print out the ERRMSG configured above<BR> 
<!-- #config SIZEFMT = "BYTE" --> 

Requirements

Client: Requires Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.

Server: Requires Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.

Product: IIS