Problem Accessing Web.Config File

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I have some appsettingin my ASP file. I try to do the following:

Colors(0) = ConfigurationSettings.AppSettings("AltColor1")
Colors(1) = ConfigurationSettings.AppSettings("AltColor2")
TitleColor = ConfigurationSettings.AppSettings("TitleColor")

This works fine in my development directory but when I move it to my testing
web site I get a System.NullReferenceException: Object reference not set to
an instance of an object.

I copied over the dll file, the aspx file and the web.config file. I
figured this was all I needed. Any thoughts?

Thanks
Chris
 
Sorry I just realized that the next line of code where I use TitleColor is
what is throwing that exception. My real question becomes why I'm not
getting the values out of the web.config file. Thanks

Chris
 
Hi Chris,

Is the production site set as an Application in IIS?

It sounds like your web.config is not being read because the app is using a
config file from higher up in the chain.
 
Back
Top