I need to have another connection string then the one in machine.config

T

Tony Johansson

Hello!

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
 
G

Guest

Hello!

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top