Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- How to read a values from new section in web.config
- <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>
- string userName = System.Configuration.ConfigurationManager.secureAppSettings["userName"];
- string userPassword = System.Configuration.ConfigurationManager.secureAppSettings["userPassword"];
- NameValueCollection section = (NameValueCollection)ConfigurationManager.GetSection("secureAppSettings");
- string userName = section["userName"];
- string userPassword = section["userPassword"];
Add Comment
Please, Sign In to add comment