Click here to Skip to main content
16,021,125 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
what is the difference writing connection string in app setting and connectionstring?
Posted
Comments
[no name] 22-Oct-12 9:30am    
Please reframe your question ... explain little more

You will access them differently. You can use ConfigurationManager.AppSettings["connectionStringName"] or you can do ConfigurationManager.ConnectionStrings["connectionStringName"]

It would make sense to put a connection string in the ConnectionStrings section. Also, some of the data driven wizards in Visual Studio will look there for existing connection strings.
 
Share this answer
 
From my perspective following are differences:

1. If connection string is in
HTML
<connectionstring></connectionstring>
, it allows you to configure these from IIS-> Application properties -> Connection string tab. Isolates from appsettings.

2. If you are using any framework, then it would always read the connection string from
HTML
<connectionstring></connectionstring>
.

3. New tag allows you to encrypt just the connection string otherwise you will end up with whole appsettings encrypted and modifying appsettings would become tricky.

IMO always use
HTML
<connectionstring></connectionstring>
to store connection string.

-Rohit
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900