Vishal Gundage
asked on
How to Add Multiple Username and password In appsettings in app.config?
why don't you continue with https://www.experts-exchange.com/questions/29078722/How-to-Add-Multiple-Username-and-password-In-appsettings-in-app-config.html
App.config
<configSections>
<section name="MultiValue1" type="System.Configuration.NameValueSectionHandler" />
</configSections>
<MultiValue1>
<add key="Credential1" value="abc|123" />
<add key="Credential2" value="pqr|456" />
</MultiValue1>
read and split on |public static List<string> GetMultiValue(string name)
{
List<string> returnValues = new List<string>();
try
{
NameValueCollection rules = ConfigurationManager.GetSection(name) as NameValueCollection;
foreach (string ruleName in rules)
{
try
{
returnValues.Add(rules[ruleName]);
}
catch
{
//Rule failed
}
}
}
catch (Exception ex)
{
//Config failed
}
return returnValues;
}
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.