-
ASP.NET使用Web.config配置數據
建立配置數據 修改Web.config文件 <configuration> <appSettings> <add key=”password” value=”cement” /> <add key=”path” value=”E:\iclweb\www\data” /> </appSettings> 配置數據的形式為key-value pair。上述例子為password和path。 使用配置數據 if (Login1.Password == ConfigurationSettings.AppSettings[“password”]) { Server.Transfer(“Search.aspx”); } 使用ConfigurationSettings.AppSettings取出相應key對應的value。