[C #] web. config-continued

Source: Internet
Author: User
Tags error status code http cookie

(1). Web. config is stored in XML format. configuration files are classified into the following formats:

1. Configuration section handler Declaration

Feature: it is located at the top of the configuration file and included in the <configsections> flag.

2. Specific Application configuration

Feature: It is located in <deleetting>. You can define global constant settings and other information of an application.

3. Configuration section settings

Features: In the <system. Web> section, you can control Asp.net runtime behaviors.

4. Configure the section group

Feature: You can use the <sectiongroup> label to customize the group, which can be placed inside <configsections> or other <sectiongroup> labels.

(2). Configuration section

1. <configuration> section

Root element, and other sections are inside it.

2. <paietting> section 54com.cn

This section defines application settings. You can also set some uncertain settings based on your actual situation.

Usage:

I.

<Deleetask>
<Add key = "conntction" value = "Server = 192.168.0.2; userid = sa; Password =; database = Info;"/>
<Deleetask>

A connection string constant is defined, and the connection string can be modified in actual application without modifying the program code.

II.

<Deleetask>
<Add key = "errpage" value = "error. aspx"/>
<Deleetask>

Defines an error redirect page. China Network Management Alliance www_bitscn_com

3. <compilation> section

Format:

<Compilation
Defaultlanguage = "C #"
DEBUG = "true"
/>

I. default language: defines the background code language. You can select C # And VB.net.

When iidebug is set to true, aspx debugging is started; if it is set to false, aspx debugging is not started, which can improve the performance of the application program running. Generally, programmers are set to true during development and false when handed over to customers.

 

4. <customerrors> section

Format:

<Customerrors
Mode = "remoteonly"
Defaultredirect = "error. aspx"
<Error statuscode = "440" Redirect = "err0000page. aspx"/>
<Error statuscode = "500" Redirect = "err500page. aspx"/>
/>

I. Mode: it 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.

Ii. defaultredirect: the URL used for redirection when an error occurs. Optional.
Iii. statuscode: indicates the error status code, indicating a specific error status.

Iv. Redirect: the URL of the error redirection.

5. <globalization> China Network Management Alliance www_bitscn_com

Format:

<Globalization
Requestencoding = "UTF-8"
Responseencoding = "UTF-8"
Fileencoding = "UTF-8"
/>

I. requestencoding: used to check the encoding of each request.

Ii. responseencoding: used to check the encoding of the returned response content.

Iii. fileencoding: used to check the default encoding for parsing files such as aspx and asax.

6. <sessionstate> section

China Network Management Forum bbs.bitscn.com

 

Format:

<Sessionstate
Mode = "inproc"
Stateconnectionstring = "TCPIP = 127.0.0.1: 42424"
Sqlconnectionstring = "Data Source = 127.0.0.1; trusted_connection = yes"
Cookieless = "false"
Timeout = "20"
/>
 

 

I. Mode: status options include off, inproc, StateServer, and sqlserver.

Ii. stateconnectionstring: Specifies the name of the server in which the Asp.net application stores the remote session status. The default value is local.

Iii. sqlconnectionstring: When a database in session status is used, set the connection string here.

Iv. cookieless: if it is set to true, the cookie session status is not used to identify the customer. Otherwise, the opposite is true.

V. Timeout: used to define the time for storing session status. If the duration is exceeded, the session is automatically terminated.

7. <authentication> section

Format:

<Authentication mode = "forms">
<Forms name = ". aspxuserdemo" loginurl = "login. aspx" Protection = "all" timeout = "30"/>
</Authentication>
<Authorization>
<Deny users = "? "/>
</Authorization>

54com.cn

I. Windows: using IIS verification methods: China Network Management Alliance WWW, bitscn, com

Ii. Forms: use form-based authentication

 

Iii. Passport: Use the passport cookie Authentication Mode 54ne.com

Iv. None: China Network Management Alliance www_bitscn_com

Meaning of the attributes of embedded forms nodes:

 

I. Name: Specifies the name of the HTTP cookie for authentication. China Network Management Alliance WWW, bitscn, com

Ii. loginurl

Iii. Protection: Specifies the cookie data protection method.

 

It can be set to: All none encryption validation.

A. All indicates encrypted data and verifies the validity of the data in two ways: China Network Management Forum bbs.bitscn.com

B. None indicates that the cookie is not protected.

 

C. Encryption indicates encryption of cookie content

 

D. validation: Verify the cookie content. 54com.cn

Iv. Timeout: Specifies the cookie expiration time. After timeout, you must log on again.

 

 

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.