Know the web.config file
The web.config file is an XML text file that is used to store configuration information for the ASP.NET web application (such as the most commonly used setting ASP.NET web application authentication mode), which can appear in every one of the application. Directory. When you create a new web application through .NET, you will automatically create a default web.config file in the root directory by default, including the default configuration settings, all subdirectories inherit it. If you want to modify the configuration settings for the subdirectories, you can create a new web.config file in the subdirectory. It provides configuration information other than configuration information inherited from the parent directory, or modifies the settings defined in the parent directory.
You can take effect on the modification of the web.config file at runtime. You can take effect (Note:
Web.config file details
Web.config configuration file (default configuration settings) All of the following items should be located
This XML tag is omitted between the examples below for the purpose of learning.
1,
Note: You can use user.Identity.name to get the current username that has been verified; you can use the web.security.formloginpage method to redirect the verified user to the page just requested. For details, please refer to : Forms Verification http://www.fanvb.net/websample/dataAuth.aspx
3,
4,
The element DEFAULTREDIRECT represents the name of the custom error page. Mode element indicates that the user who is not running on the local web server displays custom (friendly) information.
5,
6,
7,
Note: Mode = "inproc" means: store session status locally (you can also choose to store or do not enable session status) cookieless = "true" means: If the user browser does not support cookie, enable session Status (default is false) Timeout = "20" means: the session can be in the number of minutes in idle state
8,
Note: Enabled = "false" means not enable tracking; RequestLimit = "10" indicates that the number of trace requests specifying the trace requests stored on the server will use only by tracking utility access tracking output; TraceMode = "sortbytime" means Display the tracking information locaalonly = "true" indicates that the trace viewer is only used for the host web server custom web.config file configuration.
Custom Web.config file configuration section is divided into two steps. 1. Declare the name of the configuration section between the
Visit the web.config file
You can access the web.config file sample by using the configurationSettings.appsettings static string collection: Get the connection string established in the above example. E.g:
Protected static string isdebug = configurationSettings.appsettings ["debug"]