Dear All,
How to use web config app settings in silver light application page.
Web Config in Silverlight
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Jul 15, 2011, 1:18 AM EDT
You can use WebConfig file like,
And you can access the file as like,
public static string GetSomeSetting(string settingName)
{
var valueToGet = string.Empty;
var reader = XmlReader.Create("XMLFileInYourRoot.Config");
reader.MoveToContent();
while (reader.Read())
{
if (reader.NodeType == XmlNodeType.Element && reader.Name == "add")
{
if (reader.HasAttributes)
{
valueToGet = reader.GetAttribute("key");
if (!string.IsNullOrEmpty(valueToGet) && valueToGet == setting)
{
valueToGet = reader.GetAttribute("value");
return valueToGet;
}
}
}
}
return valueToGet;
}
Gomathi PalaniswamyRank #714 · 3.3K reputationPosted Jul 17, 2011, 10:07 PM EDT
Thanks for your reply.I would like to get value with out creating xml page.Can you please say some other way to access web.config appsetting value.
Manikavelu VelayuthamRank #413 · 6K reputationPosted Jul 18, 2011, 2:29 AM EDT
http://blogs.msdn.com/b/luc/archive/2009/05/29/reading-web-config-parameters-from-a-silverlight-application.aspx