ASP. NET @ page command attributes

Source: Internet
Author: User
Tags sql server injection
The @ page command is located at the top of each ASP. NET page, telling ASP. NET what attributes are used for the specific page and the user control inherited by the page. ASP. NET page @ page Directive attributes include: aspcompat, async, disconnect, autoeventwireup, buffer, classname, clientidmode, codebehind, codefile, delimiter, codePage, compilationmode, contenttype, compileroptions, culture, debug, warn, publish, disable, enableviewstate, enableviewstatemac, errorpage, explicit, inherits, language, lcid, linepragmas, maintainscrollpositiononpostback, masterpage File, metadeding, metakeywords, responseencoding, SRC, strict, stylesheettheme, theme, title, Trace, tracemode, transaction, uiculture, validaterequest, comment, viewstatemode, WarningLevel.

AspcompatBy setting the page to run in a single thread unit, ASP. NET pages can access traditional COM objects. By default, ASP. NET pages run in multi-threaded units (MTA. When the aspcompant mode is enabled, ASP. NET is set to run pages in a single-threaded unit (STA) so that it can securely interact with COM objects. Setting aspcompat to true affects performance. The default value is false.

AsyncMake the page an asynchronous processing program, that is, the page uses the ihttpasynchandler implementation to process requests. The default value is false.

AsynctimeoutDefines the timeout interval (in seconds) used to process asynchronous tasks ). The default value is 45 seconds.

AutoeventwireupIndicates whether the page events are automatically bound. True if event auto binding is enabled; otherwise, false. The default value is true.

BufferDetermine whether HTTP Response buffering is enabled. If page buffering is enabled, set this parameter to true. Otherwise, set this parameter to false. The default value is true.

ClassnameSpecifies the Class Name of the page automatically compiled when the page is requested. This value can be any valid class name and can include the complete namespace of the class. If this attribute value is not specified, the compiled class name is based on the page file name. For other pages, you can use the @ reference command to reference the class name assigned to the first page.

ClienttargetIndicates the target user proxy (usually a Web browser, such as Microsoft Internet Explorer) for which the ASP. NET Server Control should present content ). This value can be any valid alias defined in the <clienttarget> section of the application configuration file.

CodebehindSpecifies the name of the compiled file that contains the class associated with the page. This attribute cannot be used at runtime. This attribute is provided to be compatible with previous versions of ASP. NET for code hiding. In ASP. NET 2.0, you should use the codefile attribute to specify the name of the source file, and use the inherits attribute to specify the fully qualified name of the class.

CodefileSpecifies the path of the code hidden file pointing to the page reference. This property can be used together with the inherits property to associate the hidden source file of code with the webpage. This attribute is only valid for compiled pages.

CodefilebaseclassSpecifies the path of the base class of the page and its associated code hidden class. This attribute is optional, but if you use this attribute, you must use the codefile attribute at the same time. If you want to implement the following sharing scheme, you can use this attribute: In this sharing scheme, you define common fields in the base class (you can selectively define associated events) to reference the control declared on the web page. Out of ASP. net code generation model. If you do not use this attribute when defining a field in the base class, the compilation will be on the webpage (in a separate branch class stub) the declared control generates a new member definition, and the scheme you want will not take effect. However, if you use the codefilebaseclass attribute to associate the base class with the page and your branch class (its name is assigned to the inherits attribute and its source file is referenced by the codefile attribute) is inherited from the base class, the fields in the base class will be able to reference the controls on the page after the code is generated.

CodepaGE indicates the value of the encoding scheme used for the response. This value is an integer used as the encoding scheme ID. For a list of possible codePage IDs, see encoding class.

CompilationmodeSet whether to use a string that specifies one of multiple enumeration options to compile the page. The default value is always. Therefore, the. ASPX page is compiled by default. A string that contains compiler options for the compilation page. In C # and Visual Basic, This is a sequence of compiler command line switches. For more information about compiler options, see C # compiler options or visual basic compiler.

ContenttypeDefine the HTTP content type of the response as the standard MIME type.

CompileroptionsSupports any valid HTTP Content string. For a list of possible values, search for mime in the msdn library. Culture indicates the culture settings of the page. The value of this attribute must be a valid Regional ID. Note that lcid and culture attributes are mutually exclusive. If one attribute is used, another attribute cannot be used on the same page.

CultureThe dynamically generated class sets the value of this attribute. In addition, you can explicitly set the value of the culture attribute through programming or in the globalization element (ASP. NET setting architecture) of the web. config file. The culture attribute is used to help localized page content. You can set it to any valid Regional ID. For example, the en-US regional ID sets the page to American English, whileFRThe regional ID sets the page to French. You can also set this value to auto to automatically detect the preferred language of the browser and set this language. You can use the default value (such as auto: En-US) to limit automatic language detection.

DebugIndicates whether the page should be compiled using debugging symbols. True if the page should be compiled with a debug symbol; otherwise false. Because this setting affects performance, this attribute should be set to true only during development.

EnableeventvalidationEnable event verification in the resend solution. True if the event is verified; otherwise, false. The default value is true.

EnablesessionstateDefine the session status requirements for the page. If the session status is enabled, the value is true. If the session status can be read but cannot be changed, the value is readonly; otherwise, the value is false. The default value is true. These values are case insensitive.

EnablethemingIndicates whether to use a topic on the page. If the topic is used, the value is true; otherwise, the value is false. The default value is true.

EnableviewstateIndicates whether to maintain the view status between page requests. True if you want to maintain the view status; otherwise, false. The default value is true.

EnableviewstatemacIndicates whether ASP. NET should run the computer authentication check (MAC) on The View status of the page when the page is sent back from the client ). If you want to run Mac check on The View status, the value is true; otherwise, the value is false. The default value is false. View state Mac is the encrypted version of the Hidden variable. When a page is sent to a browser, the view State of the page is permanently kept in the variable. When you set this attribute to true, the encrypted view status is checked to verify that it has not been tampered with on the client. Note: setting this attribute to true affects performance because the variable values must be encrypted and decrypted during each round-trip of the page.

ErrorpageDefines the target URL to be redirected when an unhandled page exception occurs.

ExplicitDetermine whether to use visual basic option explicit mode to compile the page. If visual basic explicit compilation is enabled and all variables must be declared using dim, private, public, or redim statements, true is used; otherwise, false is used. The default value is false. This attribute is ignored in all languages except Visual Basic. In addition, this option is set to true in the machine. config configuration file.

Inherits defines the hidden classes of code that can be inherited by pages. It can be any class derived from the page class. It is used together with the codefile attribute (including the path of the source file pointing to the code hidden class.

LanguageSpecifies the language used for compiling all inline rendering (<%> and <% = %>) and Code declaration blocks on the page. The value can represent any language supported by. NET Framework, including Visual Basic, C #, or JScript. Each page can only use and specify one language.

Lcid defines the region settings identifier of the web form page. The region settings identifier is a 32-bit value that uniquely defines a region. ASP. NET uses the default region settings of web servers unless you specify different region settings for the web forms page. Note that lcid and culture attributes are mutually exclusive. If one attribute is used, another attribute cannot be used on the same page.

LinepragmasDetermine whether the Runtime Library should generate a line of mixed attention in the source code. These are compiler options, which are usually used by debugging tools to mark specific locations in the source file. True if a line notice should be generated; otherwise, false.

MaintainscrollpositiononpostbackIndicates whether to return the user to the same location in the browser on the client after sending the request. True if the user should be returned to the same position; otherwise false. The default value is false. Developers can define this attribute for all pages by setting the maintainscrollpostitiononpostback attribute on the <pages> element of the web. config file (note that this attribute is case sensitive in the configuration file.

Masterpagefile sets the path of the master page or nested master page on the Content Page. Supports relative and absolute paths.

MetadegionAdded Seo Optimization for ASP. net4.0 as page, specifying the page description displayed in the HTML <meta> tag of the response. You can also use the description as the page attribute by programming.

MetakeywordsThis is also the SEO optimization added by ASP. net4.0, specifying the keywords of the page displayed in the HTML <meta> tag of the response. You can also use the description as the page attribute by programming.

ResponseencodingIndicates the name of the encoding scheme used to include the HTTP Response of the page content. The value assigned to this attribute is a valid encoding name. For a list of possible encoding names, see encoding class. You can also call the getencodings method to obtain a list of possible encoding names and IDs.

SRCSpecifies the path of the source file containing the Code that links to the page. In the source file of the link, you can choose to include the page programming logic in the class or the Code declaration block. You can use the SRC property to link the generated provider to the page. For more information, see buildprovider class. In addition, in ASP. NET versions earlier than 2.0, the src attribute is another method to link a hidden code file to a page. In ASP. NET 2.0, the preferred way to link a hidden source file to a page is to use the inherits attribute to specify the class and use the codefile attribute to specify the path of the source file of the class.

StrictIndicates that pages should be compiled in Visual Basic optionstrict mode. If option strict is enabled, true is used; otherwise, false is used. The default value is false. This attribute is ignored in all languages except Visual Basic.

StylesheetthemeThe identifier of a valid topic used on the page. If the stylesheettheme attribute is set, a separate control can override the style settings contained in the topic. In this way, the topic provides the overall appearance of the site, and you can use the settings contained in the stylesheettheme attribute to customize the page and specific settings of each control.

ThemeThe identifier of a valid topic used on the page. If the stylesheettheme attribute is not used when you set the theme attribute, the independent style settings on the control will be overwritten, allowing you to create a unified and consistent page appearance.

TitleSpecifies the title of the page displayed in the HTML <title> tag of the response. You can also use the title as the page attribute by programming.

TraceIndicates whether to enable tracking. True if tracing is enabled; otherwise, false. The default value is false.

TracemodeIndicates how to display trace messages for pages when tracing is enabled. The possible values are sortbytime and sortbycategory. When tracing is enabled, the default value is sortbytime.

TransactionIndicates whether transactions are supported on the page. Possible values include disabled, notsupported, supported, required, and requiresnew. The default value is disabled.

UicultureSpecifies the page User Interface (UI) culture settings. Supports any valid UI culture values.

ValidaterequestIndicates whether request verification is required. If true, request verification checks all input data based on the hard-coded list of potentially dangerous values. If a match occurs, the httprequestvalidationexception is thrown. The default value is true. This feature is enabled in the computer configuration file (machine. config. You can disable this function by setting this attribute to false in the application configuration file (Web. config) or on the page. This feature helps reduce the risk of cross-site scripting attacks on simple pages or ASP. NET applications. If the application cannot correctly verify user input, it may be attacked by input in multiple formats, including cross-site scripting and Microsoft SQL Server injection attacks. All forms of input in the application should be carefully evaluated, and they must be correctly verified and encoded, or make sure that the application has exited before processing data or sending the information back to the client. There is no other way to do this.

ViewstateencryptionmodeUse three possible enumerated values to determine how to encrypt the view status: auto, always, or never. The default value is auto, indicating that if a single control request is encrypted, the view State is encrypted.

ViewstatemodeYou can set the view status of the control separately. In the previous versions of ASP. NET, the control view can be separately controlled only when the page viewstate is enabled. In ASP. net4.0, the view status of the control can be set separately. That is to say, the control can still enable the view status even if the view status of the page is not enabled.

The viewstatemode attribute is an enumerated value: inheritl: The view State inherits from the parent control. Enabled: enables the view State of the parent control even if the view State of the parent control is not enabled. Disabled: even if the view status of the parent control is enabled, the view status of the control is disabled.

WarningLevelIndicates the level of warning that you want the compiler to consider as an error (thus suspending page compilation. Possible warning levels are 0 to 4. For more information, see WarningLevel attributes.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.