Suppose I need to have a different connectionstring that the one that exist
in machine.config.
What is the best practice to do this ?
Two alternative.
1. Change in machine.config not so good I suppose.
2. Create a web.config where you made your modifications.
I would guess that alternative 2 is the best one.
One more question. Should the machine.config file never be changed ?
//Tony
The web.config file is the main configuration file for an ASP.NET web
application. Use it to store your connectionstring if this is related
to your single application only. The machine.config is for settings
that apply to an entire computer. It's located in a system directory
and normally cannot be changed e.g. on a shared hosting. (On another
hand because of this, machine.config could be a good idea to secure
settings).
Note, web.config has special connectionStrings Element, dedicated for
this purpose.
Read more
connectionStrings Element
http://msdn.microsoft.com/en-us/library/bf7sd233.aspx
How to: Read Connection Strings from the Web.config File
http://msdn.microsoft.com/en-us/library/ms178411.aspx