<1>
Some of the data needs to be written to the configuration file. We will try to write to the configuration file. For example, often change the data, or user time as long as the changes to the configuration file can be used value, such as: IP address. Port number, MD5 add salt. Wait a minute. We can write these values to the Web. config file. To get this value on the WebForm.aspx.cs page, or another page.
Note that the configuration is in the <appSettings></appSettings> file.
<?xml version= "1.0" encoding= "Utf-8"?><!-- For more information about how to configure an ASP. NET application, visit the http://go.microsoft.com/ fwlink/? linkid=169433 --><configuration> <system.web> <compilation debug= "true" targetframework= "4.0"/> </system.web> <connectionStrings> <add name= "ConnStr" connectionstring= "Data Source=fa-vaio; Initial Catalog=sales; Integrated security=true "/> </connectionStrings><!--Some data needs to be written to the configuration file. We will try to write to the configuration file. For example, often change the data, or user time as long as the changes to the configuration file can be used value, such as: IP address. Port number, MD5 add salt. Wait a minute. We can write these values to the Web. config file. On the WebForm.aspx.cs page, or another page to get this value-- <appSettings> <add key= "IP" value= "192.168.1.199"/ > <add key= "port number" value= "8080"/> <add key= "MD5 add salt" value= "my Salt"/> </appSettings> </configuration>
WebForm.aspx.cs file to obtain the
Using system.web;using system.web.ui;using system.web.ui.webcontrols;using system.configuration;namespace user activation { Public partial class WebForm4:System.Web.UI.Page { protected void Page_Load (object sender, EventArgs e) { string getip= configurationmanager.appsettings["IP"]; String Duankouhao = configurationmanager.appsettings["port number"]; String mysalt = configurationmanager.appsettings["MD5 add Salt"];}}
Save data in the Web. config configuration file, and how to obtain data from the config configuration file