תגובה
ניתן להשתמש בקובץ הקונפיגורציה של האפליקצייה (app.config, web.config) ב-section שנקרא appSettings.
<configuration> <appSettings> <add key="AppConnectionString" value="SDF879A0SD8F70AS8DF0S8DF70AS98D70FA8SD70FA"/> <add key="EnableCache" value="true"/> </appSettings> </configuration>
ומהקוד להוציא את הערכים בצורה הבאה:
string connectionString = Decrypt(ConfigurationManager.AppSettings["AppConnectionString"]); bool enableCache = Convert.ToBoolean(ConfigurationManager.AppSettings["EnableCache"]);
קובץ הקונפיגורציה נכנס לזיכרון ברגע שהאפליקציה מתחילה לרוץ כך שאין חשש מבעיות ביצועים.