Web. config file detailed

Source: Internet
Author: User

One). Web. config is stored as an XML file specification, and the configuration file is in the following format
1. Configuration section Handler declaration
Features: Located at the top of the configuration file, included in the <configSections> logo.
2. Specific application configuration
Features: Located in <appSetting>. You can define information such as global constant settings for your application.
3. Configure section Settings
Features: Located in <system. Web> section, controls the behavior of the ASP.
4. Configure section Groups
Features: With <sectionGroup> tags, you can customize the grouping, you can put in <configSections> inside or other <sectionGroup> tags inside.
(b). Each section of the configuration section
1.<configuration> Festival
The root element, the other sections are inside of it.
2.<appsetting> Festival
This section is used to define application settings items. For some uncertain settings, you can also let users according to their own actual situation set
Usage:
I.
<appSettings>
<add key= "conntction" value= "server=192.168.85.66;userid=sa;password=;d atabase=info;" />
<appSettings>
A connection string constant is defined, and the connection string can be modified in the actual application without modifying the program code.
Ii.<appsettings>
<add key= "Errpage" value= "error.aspx"/>
<appSettings>
An error redirect page is defined.
3.<compilation> Festival
Format:
<compilation
Defaultlanguage= "C #"
Debug= "true"
/>
I.default language: Defines the background code language, which can be selected in C # and vb.net two languages.
Iidebug: Is true when ASPX debugging is started, and ASPX debugging is not started for false, thus improving the application to run
Performance at the same time. The general program is set to true at development time and set to false when handed over to the customer.
4.<customerrors> Festival
Format:
<customerrors
Mode= "RemoteOnly"
defaultredirect= "Error.aspx"
<error statuscode= "redirect=" err440page.aspx "/>
<error statuscode= "$" redirect= "err500page.aspx"/>
/>
I.mode: Has the on,off,remoteonly 3 kinds of states. On means that custom information is always displayed; Off means that detailed ASP. NET error information is always displayed; RemoteOnly indicates that custom information is displayed only for users who are not running on the local Web server.
Ii.defaultredirect: The URL address used for redirection when an error occurs. is optional
Iii.statuscode: Indicates the error status code, indicating a specific error state.
Iv. Redirect: The URL of the error redirect.
5.<globalization> Festival
Format:
<globalization
Requestencoding= "Utf-8"
Resp
Fileencoding= "Utf-8"
/>
I.requestencoding: It is used to check every encoding that is sent to a request.
Ii.responseencoding: Used to check the response content encoding sent back.
Iii.fileencoding: Used to check the default encoding for file parsing such as Aspx,asax.
6.<sessionstate> Festival
Format:
<sessionstate
Mode= "InProc"
Statec
SqlC
Cookieless= "false"
Timeout= "20"
/>
I.mode: Divided into several states of Off,inproc,stateserver,sqlserver
Here is a detailed description of this property: http://sperp.cnblogs.com/archive/2005/11/01/266662.html
II. stateConnectionString: Specifies the server name of the ASP. NET application store remote session state, default to native
Iii.sqlconnectionstring: When using the session state database, set the connection string here
Iv. cookieless: When set to true, indicates that the customer is not used to identify the cookie session state;
V. TimeOut: The time that is used to define the session state store, and the session is automatically terminated when the period expires.
7.<authentication> Festival
Format:
<authentication mode= "Forms" >
<forms name= ". Aspxuserdemo "loginurl=" Login.aspx "protection=" All "timeout=" "/>"
</authentication>
<authorization>
<deny users= "?" />
</authorization>
I.windows: Using IIS authentication method
Ii. Forms: Using Forms-based authentication
Iii. Passport: Using Passport cookie Authentication mode
Iv.. None: Do not use any authentication method
The attribute meaning of the embedded forms node inside:
I.name: Specifies the name of the HTTP cookie that completes the authentication.
Ii. Loginurl: If the URL of the page is redirected after validation or timeout, it is usually the login page for the user to log in again
Iii. Protection: Specifies how the cookie data is protected.
Can be set to: all None encryption validation four ways of protection
A. All means encrypted data, and validation is done in two ways
B. None means that cookies are not protected.
C. Encryption means that the cookie content is encrypted
D. Validation indicates that the cookie content is validated for validity
Iv. TimeOut: Specifies the expiration time of the cookie. To log back in after a timeout.

Web. config file detailed

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.