ASP. NET Configuration

Source: Internet
Author: User

The <paiettings> section is used to customize application settings. The main application scope is website settings. software and hardware environment settings. main function parameter settings of the application. (public sealed class AppSettingsSection: ConfigurationSection), The appSettings configuration section provides the string value Key/value pair for the application. instead of using the instance of the deleettingssection object to access these values, you should use the deleettings attribute of the ConfigurationManager class or the deleettings attribute of the WebConfigurationManager class (public static class ConfigurationManager/WebConfigurationManager, the access modifier public/internal/protected/private public can be accessed in the entire application. internal is an assembly and static is used to modify this class, static classes can be accessed without instantiation)
<Deleetask>
<Add key = "set keyword 1" value = "value of keyword 1"/>
<Add key = "set keyword 2" value = "value of keyword 2/>
</AppSettings>
<Configuration>
<Deleetask>
<Add key = "con" value = "server = server; database = database1; uid = sa; pwd ="/>
<Add key = "sn" value = "9u0ufadfapffa6f4as"/>
</AppSettings>
</Configuration>

Configure
<HttpRuntime> Configure the ASP. net http Runtime library. This section can be declared at the computer, site, application, and subdirectory level.
<Configuration>
<System. web>
<HttpRuntime maxRequestLength = "4000" useFullyQualifiedRedirectUrl = "true" executionTimeout = "45"/>
// The maximum number of requests that appRequestQueueLimit will queue for the Application
// ExcutionTimeout: indicates the maximum number of seconds allowed to execute a request before it is automatically disabled by ASP. NET.
// MaxRequestLength supports the upload of the Maximum File
</System. web>
</Configuration>

Machine. the Config file is the root configuration file that provides the default configuration settings for the entire machine. when an application is created, it is automatically created from the Machine. copy part of the configuration code in the Conifg file as the Web. config to configure the program. it should be said that Machine. config is the template for the application to run. conifig does not set any content from the Machine. config.
Configure
<HttpModules> Configure the HTTP module in an application
<HttpModules>
<Add type = "classname, assemblyname" name = "modulename"/> // type class name, assembly, add HttpModules to the application
<Remove name = "modulname"/> // remove the HttpModule class from the application
<Clear/> // remove all HttpModule mappings from the application
<HttpModules>
Example:
<Configuration>
<System. web>
<HttpModules>
<Add type = "System. Web. Caching. OutputCacheModule" name = "OutputCache"/>
<Add type = "System. Web. SessionState. SessionStateModule" name = "Session"/>
<Add type = "Selector, selector. dll" name = "Selector"/>
<HttpModules>
</System. web>
</Configuration>

Configure <pages>
<Pages> This section identifies page-specific configuration settings. <pages> This section can be declared at the computer, site, application, and subdirectory levels.
<Pages buffer = "true/false" enableSessionState = "true/false/ReadOnly" enableViewState = "true/false" autoEventWireup = "true/false" pageBaseType = "typename, assembly "userControlBaseType =" typename "/>

There are many other types of configurations. Here we only illustrate several important ones. You can send E-Mail to me.

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.