asp.net mvc webconfig配置文件操作


 

讀取web.config數據,可以不用編譯。如發布后,非常有用
web.config文件
<configuration>
<appSettings> <add key="Pwd" value="yms6666" /> </appSettings> </configuration> c#后台代碼讀取Key為Pwd的數據
 string pwd= System.Configuration.ConfigurationManager.AppSettings["Pwd"];

 連接字符串:

 

return new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["WebJakeCS"].ConnectionString);

return new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["WebJakeCS"].ToString());


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM