title: Where to set MVC 3 Connection Strings in code
body: <p>I would like to connect to an existing database, and I put the connection string in the ConnectionStrings section of the Web.Config. But where and how do you refer to this connection in the code. For example, I try things like</p>
  
  <p>string connString = System.Configuration.ConfigurationManager.ConnectionStrings["MyDatabase"].ToString();</p>
  
  <p>in my C# code right before I read the database.</p>
  
  <p>The only way I can make it work is to hard-code the connection string in the C# code, because I don't know how to get it from Web.Config.</p>