Programming Microsoft ASP.NET 4 - Dino Esposito [97]
Transaction
Indicates whether the page supports or requires transactions. Feasible values are Disabled, NotSupported, Supported, Required, and RequiresNew. Transaction support is disabled by default.
ValidateRequest
A Boolean value that indicates whether request validation should occur. If this attribute is set to true, ASP.NET checks all input data against a hard-coded list of potentially dangerous values. This functionality helps reduce the risk of cross-site scripting attacks for pages. The value is true by default.
Attributes listed in Table 5-6 allow you to control the format of the output being generated for the page. For example, you can set the content type of the page or localize the output to the extent possible.
Table 5-6. @Page Directives for Page Output
Attribute
Description
ClientTarget
Indicates the target browser for which ASP.NET server controls should render content.
ClientIDMode
Specifies the algorithm to use to generate client ID values for server controls. This attribute requires ASP.NET 4.
CodePage
Indicates the code page value for the response. Set this attribute only if you created the page using a code page other than the default code page of the Web server on which the page will run. In this case, set the attribute to the code page of your development machine. A code page is a character set that includes numbers, punctuation marks, and other glyphs. Code pages differ on a per-language basis.
ContentType
Defines the content type of the response as a standard MIME type. Supports any valid HTTP content type string.
Culture
Indicates the culture setting for the page. Culture information includes the writing and sorting system, calendar, and date and currency formats. The attribute must be set to a non-neutral culture name, which means it must contain both language and country/region information. For example, en-US is a valid value, unlike en alone, which is considered country/region neutral.
LCID
A 32-bit value that defines the locale identifier for the page. By default, ASP.NET uses the locale of the Web server.
MetaDescription
Sets the “description” meta element for the page. The value set through the @Page directive overrides any similar values you might have specified as literal text in the markup. This attribute requires ASP.NET 4.
MetaKeywords
Sets the “keywords” meta element for the page. The value set through the @Page directive overrides any similar values you might have specified as literal text in the markup. This attribute requires ASP.NET 4.
ResponseEncoding
Indicates the character encoding of the page. The value is used to set the CharSet attribute on the content type HTTP header. Internally, ASP.NET handles all strings as Unicode.
UICulture
Specifies the default culture name used by Resource Manager to look up culture-specific resources at run time.
ViewStateEncryptionMode
Determines how and if the view state is encrypted. Feasible values are Auto, Always, or Never. The default is Auto, meaning that view state will be encrypted only if an individual control requests that.
ViewStateMode
Determines the value for the page’s ViewStateMode property that influences the way in which the page treats the view state of child controls. (More details are available in Chapter 17.) This attribute requires ASP.NET 4.
As you can see, many attributes discussed in Table 5-6 are concern with page localization. Building multilanguage and international applications is a task that ASP.NET, and the .NET Framework in general, greatly simplify.
The @Assembly Directive
The @Assembly directive adds an assembly to a collection of assembly names that are used during the compilation of the ASP.NET page so that classes and interfaces in the assembly are available for early binding to the code. You use the @Assembly directive when you want to reference a given assembly only from a specific page.
Some assemblies are linked by default for any ASP.NET application. The complete list