---
title: "Which is the best place to store connectionstring in .NET projects ?"  
description: "Which is the best place to store connectionstring in .NET projects ?"  
author: "Anonymous User"  
published: 2011-01-14  
updated: 2020-09-23  
canonical: https://www.mindstick.com/interview/322/which-is-the-best-place-to-store-connectionstring-in-dot-net-projects  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# Which is the best place to store connectionstring in .NET projects ?

web.config is the best place to store the connection string.\
for example\
<configuration> \
<appSettings>\
<add key="MyConnectionString" value="...connection string value put here..." />\
</appSettings>\
\
and retrieve it usingConfigurationSettings.AppSettings["MyConnectionString"]\
\

## Answers

### Answer by Anonymous User

web.config is the best place to store the connection string.\
for example\
<configuration> \
<appSettings>\
<add key="MyConnectionString" value="...connection string value put here..." />\
</appSettings>\
\
and retrieve it usingConfigurationSettings.AppSettings["MyConnectionString"]\
\


---

Original Source: https://www.mindstick.com/interview/322/which-is-the-best-place-to-store-connectionstring-in-dot-net-projects

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
