You can directly modify the data and add the data connection object to Web. config without re-compiling,
After modification, you need to re-compile
1. All configurations must be placed between <configuration> </configuration>,
2. <ettings> </appsettings> is a user-defined configuration, which is generally used to set some constants;
<Add> </Add> is used to add constants. The key is the name of a constant, and the value is the value of a constant.
System. configuration. configurationsettings. etettings ["key"] to reference
For example, the following database connection example ----------
] <Appsettings>
<Add key = "con" value = "Server = 127.0.0.1; database = dat; SA = sa; Pwd = sa"/>
</Appsettings>
Available on other pages
Sqlconnection con = new sqlconnection (system. configuration. configurationsettings. etettings ["con"]);
Con. open ();
Sqlcommand cmd = new sqlcommand ("select * from me", con );
This. gridview1.datasource = cmd. executereader ();
This. gridview1.databind ();
In this way, the modification is very convenient, and you do not need to re-compile it after each modification. The effect is the same as that of the class.
3. <location> </location> indicates that the region tag Path = "A" indicates that the following tag only applies to directory.
4. <system. Web> </system. Web> is the configuration of the entire application.
For example, set a buffer in it.
<Pages buffer = "true"/> // enable buffer (buffer the processed data on the server before processing all the data, otherwise, process a little bit and send a '16 K as a unit '. By default, the buffer is enabled.
When the following configuration file fails, it is redirected to a special error page. mode = "remoteonly" indicates that the detailed information can be seen on the server side, and others can be redirected to a special page.
If mode = "on", both the server and client fields are directed to genericerrorpage.htm.
<Customerrors mode = "remoteonly" defaultredirect = "genericerrorpage.htm">
<Error statuscode = "403" Redirect = "noaccess.htm"/>
<Error statuscode = "404" Redirect = "filenotfound.htm"/>
</Customerrors>
<Compilation DEBUG = "true"> during compilation, DEBUG = "true" is easy to debug, but must be changed to false at release.
Authentication: <Authentication mode = "Windows"/> by default, it is based on Windows authentication. There are four types of windows, forms, non, and passport. We generally use forms (cookies and sessions)-based
<Authentication mode = "forms">
<Forms loginurl = "login. asp" name = "Boyang" Protection = "all"> </Forms>
</Authentication>
<Authorization>
<Deny users = "?, A "/> anonymous and a are not allowed
<Allow users = "B"/>B can
</Authentication>