3

If I put configuration settings (like membership provider) DB Connnection, etc. in the "machine.config", and remove the "web.config" file from my current application, will my application work without any trouble? Is it an accepted practice in .NET?

rlb.usa
  • 14,942
  • 16
  • 80
  • 128
user274364
  • 1,797
  • 2
  • 20
  • 27

1 Answers1

0

You can do this but you need to be careful that all apps hosted on the server either comply or override the behaviour.

Here is an article that may help you: http://odetocode.com/Articles/427.aspx

Burt
  • 7,680
  • 18
  • 71
  • 127
  • 1
    Usually the `machine.config` file is not edited, and the `web.config` is used, so your proposal is an unusual one. Here's another about the differences between `machine.config` and `web.config` from the ASP.NET forums. http://forums.asp.net/p/1117776/1117776.aspx – rlb.usa Mar 30 '10 at 15:58
  • 1
    It really depends on the type of app you are building. If it is a single app on shared hosting then it wouldn't be advisable but if it is an intranet app on a server that hosts other similar apps that all share the same membership info then it would be better than duplicating the config settings. It all really depends. – Burt Mar 31 '10 at 10:33
  • @rlb.usa What's the problem in keeping Web.config file and using it instead of editing machine.config? Are there any performance issues? – ivorykoder Jan 18 '12 at 11:53
  • @ivorykoder It becomes web.config hell with multiple servers and shuffling the app here to there. Some advocate using VS's publishing options for changing the web.config depending on it's target server, but this option is not always available. (It's complicated to set up and permissions can get in the way). – rlb.usa Jan 18 '12 at 23:42