Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the format of the ASP.NET configuration file

2025-03-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

What is the format of the ASP.NET configuration file, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, hope you can gain something.

What is the purpose of the ASP.NET configuration file? The configuration information for the ASP.NET resource is contained in the configuration file set, and the name of each file is Web.config. What is the format of the ASP.NET configuration file? Each ASP.NET configuration file contains a nested hierarchy of XML tags and child tags used to specify configuration settings. Because tags must be XML in standard format, tags, child tags, and attributes are case-sensitive. Tags and attribute names are hump case, that is, the * * characters of the tag name are lowercase, while the first letters of any subsequent concatenation words are all uppercase. The property value is in the uppercase and lowercase format of Pascal, that is, * * characters in uppercase, and the first letter of any subsequent concatenation is also capitalized. True and false are exceptions, which are always lowercase.

So let's introduce you to the specific ASP.NET configuration file format:

All configuration information is located between the < configuration > and < / configuration > root XML tags. The configuration information between tags is divided into two main areas: the configuration section handler declaration area and the configuration section settings area.

The configuration section handler declaration appears at the top of the configuration file between the < configSections > and < / configSections > tags. Each declaration contained in the < section > tag specifies the name of the section that provides a specific configuration dataset and the name of the .NET Framework class that handles the configuration data in that section.

The configuration section settings area is after the < configSections > area, which contains the actual configuration settings. Each declaration in the < configSections > area has a configuration section. Each configuration section contains child tags with attributes set by that section.

The following example of a Web.config file declares two configuration < section > handlers. One handler manages application settings and the other manages session state.

< configuration > < configSections > < section name= "appSettings" type= "System.Configuration.NameValueFileSectionHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" / > < section name= "sessionState" type= "System.Web.SessionState.SessionStateSectionHandler, System.Web, Version=1.0.3300.0, Culture=neutral PublicKeyToken=b03f5f7f11d50a3a "allowDefinition=" MachineToApplication "/ > < / configSections > < appSettings > < add key=" dsn "value=" localhost < add key= "msmqserver" value= "server\ myqueue" / > < / appSettings > < sessionState cookieless= "true" timeout= "10" / > < / configuration >

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 in the virtual directory that contains the Web application files. 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 usually nested under the section group tag. Section tags at the * * level usually indicate the namespace to which the configuration settings are applied. For example, the < system.net > tag at the * * level represents the settings of the network class, while the < system.web > tag represents the settings of the ASP.NET class.

The following example shows tag nesting.

< configuration > < configSections > < sectionGroup name= "system.net" > < section name= "authenticationModules" type= "System.Net.Configuration.NetAuthenticationModuleHandler, System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" / > < section name= "webRequestModules" type= "System.Net.Configuration.WebRequestModuleHandler System, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 "/ > < / sectionGroup > < sectionGroup name=" system.web "> < section name=" authorization "type=" System.Web.Configuration.AuthorizationConfigHandler, System.Web, Version=1.0.3300.0, Culture=neutral PublicKeyToken=b03f5f7f11d50a3a "/ > < section name=" sessionState "type=" System.Web.SessionState.SessionStateSectionHandler, System.Web, Version=1.0.3300.0, Culture=neutral PublicKeyToken=b03f5f7f11d50a3a "allowDefinition=" MachineToApplication "/ > < / sectionGroup > < / configSections > < system.net >

Share To

Development

© 2024 shulou.com SLNews company. All rights reserved.

12
Report