Problem:
How to read AppSetting in Web.Config file
<appSettings>
<add key="IsMaximized" value="True"/>
<add key="IsUsed" value="False"/>
</appSettings>
How do you get the value for the key = IsUsed?
Answer
There are three ways.
1) string sGet = ConfigurationManager.AppSettings.Get("IsUsed");
2) string sIndexer = ConfigurationManager.AppSettings["IsUsed"].ToString();
3)
using System.Collections.Specialized;
NameValueCollection nvc = ConfigurationManager.AppSettings;
string sNVC = nvc["IsUsed"];
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment