none
How can we access multiple appSettings from App.config RRS feed

  • Question

  • Hi all,

    can we write the multiple appSettings from Single App.Config File?

    and then how to read values from Appsetting?

    i want to save my multiple user name and password in the App.config and then access from there.


    sumitk

    Wednesday, September 26, 2012 4:53 AM

Answers

  • I would recommend you to use some other way to store user name and password in app.config other than AppSettings, if you really need to store them in app.config. If you are building Windows application, I would just use the authentication Windows provides.

    Anyhow one way would be add the system.web element and use authentication element under that. It also seems like a little hack, but at least you can access is easily in code. More so if you are building web application.

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>
      <system.web>
        <authentication>
          <forms>
            <credentials>
              <user name="sam" password="pwd"/>
              <user name="mom" password="pas"/>
            </credentials>
          </forms>
        </authentication>
      </system.web>
    </configuration>

    Wednesday, September 26, 2012 5:28 AM