Member Avatar for RudyM

Hi all,

This is a very elementary question, but I'm a couple of days into this. Which web.config file should one store keys in? Keys to use within a Model/Controller? I see four different ones:

Project > Views > Web.config
Project > Web.config
Project > Web.config > Web.Debug.config
Project > Web.config > Web.Release.config

When testing with a key in the one located Project > Views, I don't get to see the key value using ConfigurationManager.AppSettings.Get("UserName");.

Thanks.

The second is the projects default config, where the appsettings gets it's values.

Member Avatar for RudyM

Thanks, but what is the point of the others then? I also tried WebConfigurationManager.AppSettings.Get("UserName"); thinking this might get it from a different web.config, but not the case. Can I assume that using the second web.config in my list is the standard file to use for storing keys to be used in models and controllers?

Member Avatar for RudyM

@pritaeas, that was an interesting read indeed. Thanks for that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.