views:

63

answers:

2

This might sound a bit dumb.

I always had this impression that web.config should store all settings which are suspect to change post-build and setting.settings should have the one which may change pre-build.

but I have seen projects which had like connection string in setting.settings. Connection Strings should always been in web.config, shouldnt it?

I am interested in a design perspective answer.

Just a bit of background: My current scenario is that I am developing a web application with all the three tiers abstracted in three separate visual studio projects thus every tier has its own .settings and .config file.

+2  A: 

Web.config is mostly meant for configuration, and it also stores the default values of your settings, while Settings.settings is just a convenience file for Visual Studio to provide a UI for editing your settings.

The .config comes in two different flawors: App.config for Windows applications, which will be named YourApplication.exe.config, and the Web.config for web applications. They share the same schema, syntax, and options.

  • You may notice that if you add a setting to Settings.settings, it gets added to the .config as well.
  • The .config must be deployed with apps, but Settings.settings doesn't need to
Venemo
Yea, I just noticed that it does add settings in the config file. So basically Setting.settings is kind of a UI for adding stuff into config file. isn't it?
nEEbz
@Muneeb - Yes, and it provides you a class conveniently access your settings. But under the hood, they are in the .config.
Venemo
A: 

Setting.settings is a class, it is not used to store the connection string as such, it is used to expose a specific connection string from web/app.config as a property on a class. VS does also tend to hard code a default value if the particular connnection string cannot be found.

Ben Robinson