ASP.NET configuration file format

xiaoxiao2021-03-06  43

The configuration information of the ASP.NET resource is included in a set of configuration files, each file is named Web.config. Each profile contains an XML tag and a sub-tag nested hierarchy with a specified properties that specify configuration settings. Because these tags must be the correct XML of the format, the tags, sub-tags, and attributes are case sensitive. The tagname and attribute name are Camel case, which means that the first character of the tagname is lowercase, and the first letter of any back connection word is capitalized. The attribute value is PASCAL case, which means that the first character is capitalized, and the first letter of any back connection word is also capitalized. True and false exceptions, they are always lowercase.

All configuration information reside between the and root XML tag. The configuration information between the tag is divided into two main regions: Configure the section handler declaration area and configuration section setting area.

Configuration section handler declaration between the and tags of the configuration file. Each declaration included in the

tag specifies the name of the section that provides a section of the specific configuration dataset and the name of the .NET Framework class that processes configuration data in the section.

The configuration section setting area is after the area, which contains the actual configuration settings. Each statement in the area has a configuration section. Each configuration section contains a sub-tag that contains the properties that contain this section.

The following Web.config file example declares two configuration

handler. A management application settings, another management session state.

TYPE = "System.configuration.nameValueFileeSectionHandler,

System, Version = 1.0.3300.0,

Culture = neutral, publickeytoken = b77a5c561934e089 "/>

TYPE = "System.Web.SessionState.SessionStateSecionLer,

System.Web, Version = 1.0.3300.0, culture = neutral,

PublickeyToken = B03F5F7F11D50A3A "

Allowdefinition = "MachineToApplication" />

You only need to declare the configuration section handler once. You can place it in the root machine.config file of the server or in the web.config file containing the virtual directory of the web application file. The configuration file in the subdirectory automatically inherits the configuration handler declared in the parent directory. For more information, see Configuring Inheritance. Configuration settings are often nested together under the segment marker. These top-level markers typically indicate the namespaces applied to the configuration settings. For example, the top-level tag indicates the setting of the network class, the tag indicates the setting of the ASP.NET class.

The following example shows the tag nested.

> SYSTEM.NET ">

Type = "System.net.configuration.NetAutAuthenticationModuleHandler,

System, Version = 1.0.3300.0, Culture = Neutral,

PublicKeyToken = B77A5C561934E089 "/>

TYPE = "System.net.configuration.WebrequestModuleHandler,

System, Version = 1.0.3300.0, Culture = Neutral,

PublicKeyToken = B77A5C561934E089 "/>

TYPE = "System.Web.configuration.authorizationConfighandler,

System.Web, Version = 1.0.3300.0, culture = neutral,

PublicKeyToken = B03F5F7F11D50A3A "/>

TYPE = "System.Web.SessionState.SessionStateSecionLer,

System.Web, Version = 1.0.3300.0, culture = neutral,

PublickeyToken = B03F5F7F11D50A3A "

Allowdefinition = "MachineToApplication" />

Allow users = "[comma Separated List of users]"

Roles = "[COMMA SEPARATED LIST OF ROLES]" />

Roles = "[COMMA SEPARATED LIST OF ROLES]" />

->

SqlConnectionstring = "data source = localhost;

Integrated security = SSPI;

Initial catalog = northwind

Cookieles = "false"

TIMEOUT = "10" />

The ASP.NET configuration infrastructure does not make any assumptions for the type of configuration data supported by the infrastructure. Configure the section processing program class to process all web.config data. You can use the predefined configuration segment handler with .NET Framework, or you can create your own handlers to handle your own custom configuration data.

转载请注明原文地址:https://www.9cbs.com/read-117340.html

New Post(0)