views:

320

answers:

0

I am trying to access some key=>values in appSettings in my web.config but keep getting an error: Object reference not set to an instance of an object.

I would assume this means that it cannot find the values in SharePoints web.config file. I have added this:

<appSettings>                   
          <add key="SAWServer" value="http://example.com" />
          <add key="SAWUser" value="user" />
          <add key="SAWPwd" value="pass" />     
    </appSettings>                                                              

Then I try to access one of the values by doing System.Configuration.ConfigurationManager.appSettings["SAWServer"].ToString(), but no luck. Any ideas?

It seems as though my code is just not finding the entries in the web.config. I tried restarting IIS and such but no luck. Thanks.