Web.config dosyasında örnek kodun altında var.Web.config dosyasındaki özel bölümden değerler nasıl okunur?
<configuration>
<configSections>
<section name="secureAppSettings" type="System.Configuration.NameValueSectionHandler, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>
<secureAppSettings>
<add key="userName" value="username"/>
<add key="userPassword" value="password"/>
</secureAppSettings>
</configuration>
Benim yeni bölüm secureAppSettings
şifresi çözülür ve içindeki iki anahtar yaşıyor.
string userName = System.Configuration.ConfigurationManager.secureAppSettings["userName"];
string userPassword = System.Configuration.ConfigurationManager.secureAppSettings["userPassword"];
Ama bu alanlar için null
dönüyor:
Değerleri nasıl alabilirim?
en kullanışlı ve her zaman çalışan çözüm Bence bu biridir: http://stackoverflow.com/a/28600293/4250041 – benraay