We help IT Professionals succeed at work.
Get Started

NULLS for APPCONFIG in Visual Studio 2012 - C#

teknovation asked
Last Modified: 2016-03-23
Can  someone tell me why I keep getting nulls when I reference the app.config file in Visual Studio 2012?

.cs file:
string ServiceUrl = ConfigurationManager.AppSettings["webUrl"];
 string userName = ConfigurationManager.AppSettings["UserName"];

Open in new window

App Config file:
<?xml version="1.0" encoding="utf-8" ?>
    <add key="webUrl" value="https://development.api.crm.dynamics.com/XrmServices/2011/Organization.svc" /> 
    <add key="UserName" value="test"/>
    <add key="Password" value="test123"/> -->
    <add key="UserNameDevice" value="160hmrajfdsg" />
    <add key="PasswordDevice" value="TJ*aahg1z9;W" />
    <add key="Domain" value="Test" />
    <add key="ClientSettingsProvider.ServiceUri" value="" />
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6" />
    <membership defaultProvider="ClientAuthenticationMembershipProvider">
        <add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" />
    <roleManager defaultProvider="ClientRoleProvider" enabled="true">
        <add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400" />

Open in new window

Watch Question
Most Valuable Expert 2011
Top Expert 2015
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE