Where we should give the Connection String whether in (Web .Config or .cs or seperate class file )?
which is more secure?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Francis SusaimichaelRank #466 · 5.4K reputationPosted Jun 14, 2016, 10:12 PM EDT
Mostly the connection strings are kept in "Web.config" files.It providesa lot offlexibility and easy to maintain.
1.You can easily modify at any time.
Rajeesh MenothRank #118 · 18.4K reputationPosted Jun 14, 2016, 8:52 PM EDT
Ashiwani SharmaRank #5,816 · 285 reputationPosted Jun 14, 2016, 9:00 PM EDT
ali tuncerRank #1,498 · 1.1K reputationPosted Jun 14, 2016, 9:29 PM EDT
If you are not encrypting the connecting string, I think it is better to leave it inside code, it is recommended to store it in config files, but you need to encrypt it first.
https://msdn.microsoft.com/en-us/library/dtkwfdky(v=vs.100).aspx
Surya KantRank #958 · 2.1K reputationPosted Jun 14, 2016, 9:31 PM EDT
Vinay SinghRank #604 · 4K reputationPosted Jun 14, 2016, 10:19 PM EDT
ToString();
Retrieve Connection String From Web.config In ASP.net Using C#.Net (AppSettings,ConnectionStrings)