title: Refer current executing assembly config settings
body: <p>I am trying to read the connection string value from the current executing assembly's config settings-</p>
  
  <pre><code>public static string ConnectionString
  {
      get
      {
          string path = Assembly.GetExecutingAssembly().Location;
  
          Configuration config = ConfigurationManager.OpenExeConfiguration(path);
  
          return config.ConnectionStrings["DBCon"].ToString();
      }
  }
  </code></pre>
  
  <p>I am getting below error which says- </p>
  
  <blockquote>
    <p>'ConfigurationElement.this[ConfigurationProperty]' is inaccessible due
    to it's protection level</p>
  </blockquote>
  
  <p><a href="https://i.stack.imgur.com/BDLpP.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BDLpP.jpg" alt="enter image description here"></a></p>
  
  <p>Any help on this?</p>