asp学习网: 首页 >> asp对象 >> @ Directives Reference

@ Directives Reference

You can use @ processing directives in your scripts to send information to IIS about how to process an .asp file. For example, the following script uses the @LANGUAGE processing directive to set the scripting language to VBScript.

<%@Language=VBScript
Dim myvar
Application("myvar") = This is my var
Response.Write(myvar)
%>

@CODEPAGE
You can use the @CODEPAGE directive to set the code page to be used for the .asp file. A code page is a character set, which can include numbers, punctuation marks, and other glyphs. Different languages and locales may use different code pages. For example, ANSI code page 1252 is used for American English and most European languages; OEM code page 932 is used for Japanese Kanji.

A code page can be represented in a table as a mapping of characters to single-byte values or multibyte values. Many code pages share the ASCII character set for characters in the range 0x00–0x7F.

You can override the code page that has been set by the @CODEPAGE directive with the Session.CodePage property. Doing so, however, only applies to script running within the scope of the session.

Syntax
<%@ CODEPAGE=codepage%>

Parameters
codepage
An unsigned integer that represents a valid code page for the system that is running the ASP scripting engine.

@ENABLESESSIONSTATE

You can use the @ENABLESESSIONSTATE directive to turn off session tracking for a page. Session tracking maintains information about a set of requests that are issued by a single client. If your page does not rely on session information, turning off session tracking may decrease the time it takes for IIS to process the script.

Syntax
<%@ ENABLESESSIONSSTATE=True|False %>

@LANGUAGE
You can use the @LANGUAGE directive to set the language that will be used to interpret the commands in a script. You can set your scripting language to any scripting engine that has been installed in IIS. The default scripting language is VBScript, so if you do not include a @LANGUAGE directive in your script, the script will be interpreted by the VBScript engine.

Syntax
<%@ LANGUAGE=scriptengine %>

Parameters
Scriptengine
The script engine that should compile the script. IIS ships with two script engines, VBScript and JScript.

@LCID
You can use the @LCID directive to set the locale identifier (LCID) for a script. The LCID is a DWORD containing the language identifier in the lower word and a reserved value in the upper word. The identifier supplied in an LCID is a standard international numeric abbreviation. This LCID has the components necessary to uniquely identify one of the installed system-defined locales. There are two predefined LCID values. LOCALE_SYSTEM_DEFAULT is the system default locale, and LOCALE_USER_DEFAULT is the current user's locale.

Syntax
<%@ LCID=localeidentifier %>

@TRANSACTION
You can use the @TRANSACTION directive to indicate that the script should be treated as a transaction. If a script is treated as a transaction, Microsoft Transaction Server (MTS) will create a transaction to coordinate the updating of resources.

Syntax
<%@ TRANSACTION=value %>

Parameters
Value
A string that indicates the type of transaction support. Possible values are: Value Meaning
Required The script will initiate a transaction.
Requires_New The script will initiate a transaction.
Supported The script will not initiate a transaction.
Not_Supported The script will not initiate a transaction.


Remarks
If a script contains the @TRANSACTION directive, it must be the very first line in the .asp file, otherwise an error is generated. You must add the directive to each page that should be run under a transaction. The current transaction ends when the script finishes processing.





from:asp学习网/title:@ Directives Reference/ time:2006-11-1 23:07:40

本文主题@ Directives Reference

asp教程 ©2006-2007 aspxuexi.com | 关于站点 | 版权隐私 | 站内搜索
复制或者翻版 请于夜间进行