Summary of Web. config (application configuration information)

Source: Internet
Author: User
Tags configuration settings http cookie

Web. config is an XML text file used to store ASP. NET Web application configuration information (for example, the most common settings ASP. NET Web application authentication method), which can appear in every directory of the application. When you pass. after creating a Web application, a default Web application is automatically created in the root directory by default. config file, including the default configuration settings. All subdirectories inherit its configuration settings. If you want to modify the configuration settings of a subdirectory, you can create a Web. config file under the subdirectory. It can provide configuration information other than the configuration information inherited from the parent directory, or rewrite or modify the settings defined in the parent directory.

Modifications to the Web. config file at runtime can take effect without restarting the Service (Note: Exceptions in section ). Of course, the Web. config file can be expanded. You can customize new configuration parameters and write the configuration section handler to process them.
Copy codeThe Code is as follows:
<? Xml version = "1.0"?>
<Configuration>
<! -- Specify the configuration section and namespace declaration. Clear: removes all references to inherited sections and section groups. Only the sections and section groups added by the current section and sectionGroup elements are allowed. Remove: removes references to inherited sections and groups. Section: defines the association between the configuration section handler and the configuration element. SectionGroup: defines the association between the configuration section handler and the configuration section. -->
<ConfigSections>
<SectionGroup name = "system. web. extensions "type =" System. web. configuration. systemWebExtensionsSectionGroup, System. web. extensions, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 ">
<SectionGroup name = "scripting" type = "System. Web. Configuration. ScriptingSectionGroup, System. Web. Extensions, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35">
<Section name = "scriptResourceHandler" type = "System. web. configuration. scriptingScriptResourceHandlerSection, System. web. extensions, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 "requirePermission =" false "allowDefinition =" MachineToApplication "/>
</SectionGroup>
</SectionGroup>
<Section name = "rewriter" type = "Intelligencia. UrlRewriter. Configuration. RewriterConfigurationSectionHandler, Intelligencia. UrlRewriter"/>
</ConfigSections>
<! -- AppSettings is an application setting that defines global constant settings and other information of the application. -->
<Deleetask>
<Add key = "ErrPage" value = "http://www.cnblogs.com"/>
</AppSettings>
<! -- Connection string settings -->
<ConnectionStrings>
<Add name = "sqlConnectionString" connectionString = ""/>
</ConnectionStrings>
<! -- Specify the resources configured for the Application sub-configuration and lock the configuration settings to prevent them from being overwritten by the configuration file. Path specifies the resource of the configuration settings contained in the application. Whether allowOverride allows rewriting of configuration files improves the security of configuration files. -->
<Location path = "Default. aspx" allowOverride = "false">
<! -- Control asp.net runtime behavior -->
<System. web>
<! -- Identity controls the authentication identity of web applications. -->
<Identity impersonate = "false"/>
<! -- Identifies page-specific configuration settings (such as whether to enable session Status, view status, and whether to detect user input ). <Pages> statements can be made at the computer, site, application, and subdirectory level.
MasterPageFile: the default homepage is Index.
Theme: The topic is Default.
Buffer: Specifies whether the URL resource uses response buffer. The default value is True.
EnableViewStateMac: Specifies whether ASP. NET should run the message authentication code (MAC) on The View status of the page when a page is sent back from the client ). If the value is True, the encrypted view status is checked to verify whether the view status has been tampered with on the client. The default value is True.
ValidateRequest: Indicates ASP. NET to check for potentially dangerous data from all the content entered by the browser. If it is True, request verification is performed by comparing all input data with a list of potentially dangerous values. If a match occurs, ASP. NET will cause an HttpRequestValidationException. The default value is True.
EnableViewState: Specifies whether the view State is enabled and maintained between multiple page requests. The default value is True. -->
<Pages masterPageFile = "Index" theme = "Default" buffer = "true" enableViewStateMac = "true" validateRequest = "false" enableViewState = "false">
<! -- The controls element defines the set of register commands and namespaces where the tag prefix is located -->
<Controls> </controls>
<! -- Set of import commands used during assembly pre-Compilation -->
<Namespaces> </namespaces>
</Pages>
<! -- Default error page settings.
Mode: has three states: On, Off, And RemoteOnly. On indicates that custom information is always displayed; Off indicates that detailed asp.net error information is always displayed; RemoteOnly indicates that custom information is only displayed for users not running On the Local Web server.
DefaultRedirect: Used to redirect the URL address when an error occurs. -->
<CustomErrors defaultRedirect = "Err.html" mode = "RemoteOnly">
<! -- Special code number error from targeted file -->
<Error statusCode = "403" redirect = "NoAccess.htm"/>
<Error statusCode = "404" redirect = "FileNotFound.htm"/>
</CustomErrors>
<! -- Configure debugging and tracking.
Enabled: whether to enable tracing for the application. The default value is false.
LocalOnly: Specifies whether the Trace Viewer (Trace. axd) is only used on the Web server of the host. If it is false, the trace viewer can be used on any computer. By default, the Trace. axd viewer is added to the httpHandlers element. The default value is true.
PageOutput: Specifies whether to display the trace output at the end of each page. If it is false, the trace output can only be accessed through the trace utility. The default value is false.
RequestLimit: specifies the number of Trace Requests stored on the server. If the limit is reached and the mostRecent attribute is false, the trail is automatically disabled. The maximum number of requests is 10,000. If a value greater than 10,000 is specified, ASP. NET will forward it to 10,000 without any prompt. The default value is 10.
TraceMode: Specifies the sequence in which trace information is displayed. The traceMode feature can be one of the following possible values.
Value description
SortByCategory indicates that the trace information is displayed alphabetically according to the user-defined category. SortByTime indicates that the trace information is displayed in the order of processing the trace information.
The default value is SortByTime. -->
<Trace enabled = "true" localOnly = "false" pageOutput = "true" requestLimit = "15" traceMode = "SortByCategory"/>
<! -- Set compilation debug = "true" to insert the debugging symbol into the compiled page. However, this affects performance, so this value is set to true only during development. Set the default development language C #. Whether batch supports batch processing -->
<Compilation debug = "true" defaultLanguage = "c #" batch = "false">
<Assemblies>
<! -- Added assembly reference. Every time an assembly is added, it indicates that your application has depended on an assembly and you can use it in your application. -->
<Add assembly = "System. Web. Extensions, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35"/>
<Add assembly = "System. Design, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = B03F5F7F11D50A3A"/>
<Add assembly = "System. Web. Extensions. Design, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken = 31BF3856AD364E35"/>
<Add assembly = "System. Windows. Forms, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = B77A5C561934E089"/>
<Add assembly = "System. Web, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = B03F5F7F11D50A3A"/>
<Add assembly = "System, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = B77A5C561934E089"/>
<Add assembly = "System. Xml, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = B77A5C561934E089"/>
<Add assembly = "System. Drawing, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = B03F5F7F11D50A3A"/>
<Add assembly = "System. Data, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = B77A5C561934E089"/>
<Add assembly = "System. Web. Services, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = B03F5F7F11D50A3A"/>
<Add assembly = "System. Configuration, Version = 2.0.0.0, Culture = neutral, PublicKeyToken = B03F5F7F11D50A3A"/>
</Assemblies>
<! -- Define a set of providers used to compile custom resource files. -->
<BuildProviders>
<Add extension = ". aspx" type = "System. Web. Compilation. PageBuildProvider"/>
<Add extension = ". ascx" type = "System. Web. Compilation. UserControlBuildProvider"/>
<Add extension = ". master" type = "System. Web. Compilation. MasterPageBuildProvider"/>
<Add extension = ". asmx" type = "System. Web. Compilation. WebServiceBuildProvider"/>
<Add extension = ". ashx" type = "System. Web. Compilation. WebHandlerBuildProvider"/>
<Add extension = ". soap" type = "System. Web. Compilation. WebServiceBuildProvider"/>
<Add extension = ". resx" type = "System. Web. Compilation. ResXBuildProvider"/>
<Add extension = ". resources" type = "System. Web. Compilation. ResourcesBuildProvider"/>
<Add extension = ". wsdl" type = "System. Web. Compilation. WsdlBuildProvider"/>
<Add extension = ". xsd" type = "System. Web. Compilation. XsdBuildProvider"/>
<Add extension = ". rdlc" type = "Microsoft. Reporting. RdlBuildProvider, Microsoft. ReportViewer. Common, Version = 8.0.0.0, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a"/>
</BuildProviders>
</Compilation>
<! -- In the <authentication> section, you can configure the Security authentication mode used by ASP. NET to identify the passed-in user. Windows: Use the IIS authentication method. Forms: use form-based authentication. Passport: uses the Passport cookie Authentication mode. None: no verification method is used. -->
<Authentication mode = "Forms">
<! -- Name: Specifies the Name of the Http cookie that completes authentication.
LoginUrl: If the page URL is redirected after verification is not passed or timeout, it is generally the logon page, and the user is logged on again.
Protection: Specifies the cookie data Protection method. You can set it to "All" to encrypt the data and verify the validity. "None" indicates that the Cookie is not protected, "Encryption" indicates that the Cookie content is encrypted, and "validation" indicates that the Cookie content is validated.
TimeOut: Specifies the Cookie expiration time. After timeout, you must log on again. -->
<Forms name = ". ASPXUSERDEMO" loginUrl = "Login. aspx" protection = "All" timeout = "30"/>
</Authentication>
<! -- Control access to the client of the URL Resource (for example, Anonymous Users are allowed to access the resource ). This element can be declared at any level (computer, site, application, subdirectory or page. Must be used with the <authentication> section. This means that anonymous users are not authenticated. Reject user weipeng -->
<Authorization>
<Allow users = "*"/>
<Deny users = "weipeng"/>
<Allow users = "aa" roles = "aa"/>
</Authorization>
<! -- Website globalization settings, requestEncoding: used to check the encoding of each request. ResponseEncoding: used to check the encoding of the returned response content. fileEncoding: used to check the default encoding for parsing files such as aspx and asax. The default encoding is UTF-8 -->
<Globalization requestEncoding = "gb2312" responseEncoding = "gb2312" fileEncoding = "gb2312"/>
<! -- Sets the session status.
Mode: status options include off, Inproc, StateServer, and SqlServer. Mode = "InProc" storage in the process. features: it has the best performance and the fastest speed, but cannot be shared across multiple servers. Mode = "StateServer" is stored in a status server. Features: This method is used when user session information needs to be maintained across servers. However, the information is stored on the Status server. If the status server fails, the information will be lost. Mode = "SqlServer" is stored in SQL server. features: the workload increases, but the information is not lost.
StateConnectionString: Specifies the name of the server in which the asp.net application stores the remote session status. The default value is local.
SqlConnectionString: When a database in session status is used, set the connection string here.
Cookieless: When set to flase, the cookie session status is used to identify the customer.
Timeout: indicates the session timeout. -->
<SessionState mode = "InProc" stateConnectionString = "tcpip = 127.0.0.1: 42424" sqlConnectionString = "data source = 127.0.0.1; trusted_Connection = yes "cookieless =" false "timeout =" 20 "> </sessionState>
<! -- Set the view status on the ASP. NET application configuration page. Set the number of items to be stored in the page history. -->
<SessionPageState historySize = "9"/>
<! -- Configure asp.net http Runtime Library settings. You can declare at the computer, site, application, and sub-directory level that a maximum of 100 requests are allowed, and the maximum allowed request execution time is 80 seconds. The size of the files uploaded by the user is controlled. The default value is 4 MB. UseFullyQualifiedRedirectUrl client redirection does not need to be automatically converted to a fully qualified format. -->
<HttpRuntime appRequestQueueLimit = "100" executionTimeout = "80" maxRequestLength = "40960" useFullyQualifiedRedirectUrl = "false"/>
<! -- HttpModules configures the HTTP module in an application. -->
<HttpModules>
<Add name = "OutputCache" type = "System. Web. Caching. OutputCacheModule"/>
<Add name = "Session" type = "System. Web. SessionState. SessionStateModule"/>
<Add name = "WindowsAuthentication" type = "System. Web. Security. WindowsAuthenticationModule"/>
<Add name = "FormsAuthentication" type = "System. Web. Security. FormsAuthenticationModule"/>
<Add name = "PassportAuthentication" type = "System. Web. Security. PassportAuthenticationModule"/>
<Add name = "RoleManager" type = "System. Web. Security. RoleManagerModule"/>
<Add name = "UrlAuthorization" type = "System. Web. Security. UrlAuthorizationModule"/>
<Add name = "FileAuthorization" type = "System. Web. Security. FileAuthorizationModule"/>
<Add name = "AnonymousIdentification" type = "System. Web. Security. AnonymousIdentificationModule"/>
<! -- Rewrite the custom URL. The type is basically the dll name. -->
<Add name = "UrlRewriter" type = "Intelligencia. UrlRewriter. RewriterHttpModule, Intelligencia. UrlRewriter"/>
<Add name = "Profile" type = "System. Web. Profile. ProfileModule"/>
</HttpModules>
<! -- HttpHandlers is used to send a user's request to the corresponding handler Based on the URL and HTTP predicate of the user request. You can configure this node at any configuration level, that is, you can perform special processing on the specified special files in a specific directory.
Add: Specifies the predicate/path mapped to the handler.
Clear: removes all currently configured or inherited handler mappings.
Remove: remove the predicate/path mapped to the handler. The remove command must exactly match the predicate/path combination of the previous add command. This command does not support wildcards. -->
<HttpHandlers>
<Remove verb = "*" path = "*. asmx"/>
<Add verb = "*" path = "*. asmx "validate =" false "type =" System. web. script. services. scriptHandlerFactory, System. web. extensions, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 "/>
<Add verb = "*" path = "* _ AppService. axd "validate =" false "type =" System. web. script. services. scriptHandlerFactory, System. web. extensions, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 "/>
<Add verb = "GET, HEAD" path = "ScriptResource. axd "type =" System. web. handlers. scriptResourceHandler, System. web. extensions, Version = 1.0.61025.0, Culture = neutral, PublicKeyToken = 31bf3856ad364e35 "validate =" false "/>
<Add verb = "POST, GET" path = "ajaxpro/*. ashx" type = "AjaxPro. AjaxHandlerFactory, AjaxPro.2"/>
</HttpHandlers>
<! -- Configure attributes for cookies used by Web applications.
Domain: Set the Cookie domain name.
HttpOnlyCookies: Enable httponlycookie output in Internet Explorer 6 SP1. The default value is false.
RequireSSL: gets a value indicating whether Secure Socket Layer (SSL) communication is required. -->
<HttpCookies httpOnlyCookies = "false" requireSSL = "false"/>
<! -- Controls the behavior of ASP. NET Web services and their clients.
Protocols: Specifies the transmission protocol. ASP. NET can use these transmission protocols to decrypt HTTP -->
<WebServices>
<Protocols>
<Add/>
</Protocols>
</WebServices>
<! -- Configure cache settings for Web applications.
Cache: defines global application cache settings.
OutputCache: Specifies the output cache settings within the application range.
OutputCacheSettings: Specifies the output cache settings that can be applied to pages in applications.
SqlCacheDependency: Configure SQL cache dependencies for ASP. NET applications. -->
<Caching>
<Cache disableMemoryCollection = "false" disableExpiration = "false" privateBytesLimit = "0" percentagePhysicalMemoryUsedLimit = "90" privateBytesPollTime = "00:02:00"/>
<! -- When designing a page that needs to be cached in this way, you need to add the following command to the page: <% @ OutputCache CacheProfile = "ServerOnly" %> -->
<OutputCacheSettings>
<OutputCacheProfiles>
<Add name = "ServerOnly" duration = "60" varyByCustom = "browser" location = "Server"/>
</OutputCacheProfiles>
</OutputCacheSettings>
</Caching>
</System. web>
</Location>
<! -- Network settings. AuthenticationModules: indicates the module used to authenticate Internet requests. ConnectionManagement: specifies the maximum number of connections to the Internet host. DefaultProxy: configure the Hypertext Transfer Protocol (HTTP) proxy server. MailSettings: configure the mail sending option for the Simple Mail Transmission Protocol (SMTP. RequestCaching: controls the cache mechanism of network requests. Settings: Configure basic network options for System. Net. -->
<System.net>
<! -- Configure SMTP email settings -->
<MailSettings>
<Smtp from = "sy">
<Network host = "Gao" password = "" userName = ""/>
</Smtp>
</MailSettings>
<! -- Disable all caches -->
<RequestCaching disableAllCaching = "true"> </requestCaching>
<! -- Specifies the proxy address and skips the proxy for local access and contoso.com. -->
<DefaultProxy>
<Proxy usesystemdefault = "True" proxyaddress = "http: // 192.168.1.10: 3128" bypassonlocal = "True"/>
<Bypasslist>
<Add address = ""/>
</Bypasslist>
</DefaultProxy>
</System.net>
<! -- This section replaces the AJAX-related HTTP processing programs and modules added in httpHandlers and httpModules. This section enables IIS 7.0 to use these processing programs and modules when running in integrated mode. The system. webServer Section is required to run ASP. net ajax under iis7.0. This section is not required for earlier versions of IIS. -->
<System. webServer>
<Validation validateIntegratedModeConfiguration = "false"/>
<Modules>
<Add name = "ScriptModule" preCondition = "integratedMode" type = "System. web. handlers. scriptModule, System. web. extensions, Version = 3.5.0.0, Culture = neutral, PublicKeyToken = 31BF3856AD364E35 "/>
</Modules>
<Handlers>
<Remove name = "WebServiceHandlerFactory-Integrated"/>
<Add name = "ScriptHandlerFactory" verb = "*" path = "*. asmx "preCondition =" integratedMode "type =" System. web. script. services. scriptHandlerFactory, System. web. extensions, Version = 3.5.0.0, Culture = neutral, PublicKeyToken = 31BF3856AD364E35 "/>
<Add name = "ScriptHandlerFactoryAppServices" verb = "*" path = "* _ AppService. axd "preCondition =" integratedMode "type =" System. web. script. services. scriptHandlerFactory, System. web. extensions, Version = 3.5.0.0, Culture = neutral, PublicKeyToken = 31BF3856AD364E35 "/>
<Add name = "ScriptResource" preCondition = "integratedMode" verb = "GET, HEAD" path = "ScriptResource. axd "type =" System. web. handlers. scriptResourceHandler, System. web. extensions, Version = 3.5.0.0, Culture = neutral, PublicKeyToken = 31BF3856AD364E35 "/>
</Handlers>
</System. webServer>
<! -- Configure ASP. NET service in ASP. net ajax -->
<System. web. extensions>
<! -- Configure JSON serialization -->
<Scripting>
<WebServices>
<JsonSerialization maxJsonLength = "5000" type = "codeph" text = "/codeph"/>
</WebServices>
</Scripting>
</System. web. extensions>
<! -- Configure WCF -->
<System. serviceModel>
<Services>
<Service name = "WCFStudent. WCFStudentText" behaviorConfiguration = "ServiceBehavior">
<! -- Service Endpoints -->
<Endpoint address = "" binding = "wsHttpBinding" contract = "WCFStudent. IStuServiceContract">
<! -- During deployment, the following identification elements should be deleted or replaced to reflect the identity of the deployed service under it. After deletion, WCF automatically derives the corresponding identifier. -->
<Identity>
<Dns value = "localhost"/>
</Identity>
</Endpoint>
<Endpoint address = "mex" binding = "mexHttpBinding" contract = "IMetadataExchange"/>
</Service>
</Services>
<Behaviors>
<ServiceBehaviors>
<Behavior name = "ServiceBehavior">
<! -- To avoid metadata leakage, set the following value to false before deployment and delete the above metadata endpoint -->
<ServiceMetadata httpGetEnabled = "true"/>
<! -- To receive fault exception details for debugging, set the following value to true. Set it to false before deployment to avoid leakage of exception information -->
<ServiceDebug includeExceptionDetailInFaults = "false"/>
</Behavior>
</ServiceBehaviors>
</Behaviors>
</System. serviceModel>
<! -- URL redirection -->
<Rewriter>
<Rewrite url = "~ /User/u (. +). aspx "to = "~ /User/index. aspx? R = $1 "/>
<Rewrite url = "~ /Ask/q (. +). aspx "to = "~ /Home/ask/content. aspx? Id = $1 "/>
<Rewrite url = "~ /Blog/B (. +). aspx "to = "~ /Home/blog/article. aspx? R = $1 "/>
<Rewrite url = "~ /News/n (. +). aspx "to = "~ /Home/news/content. aspx? Nid = $1 "/>
<Rewrite url = "~ /Default. aspx "to = "~ /Home/ram/net. aspx "/>
</Rewriter>
</Configuration>

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.