title: Best way to read contents of web.config
body: <p>I need to read the contents of the Web.Config and send them off in an email, is there a better way to do the following:</p>
  
  <pre><code>        string webConfigContents = String.Empty;
          using (FileStream steam = new FileStream(
                   Server.MapPath("~/web.config"),
                   FileMode.Open, FileAccess.Read, FileShare.Read))
          {
              using (StreamReader reader = new StreamReader(steam))
              {
                  webConfigContents = reader.ReadToEnd();
              }
          }
  </code></pre>
  
  <p>I dont want to lock the file. Any ideas?</p>
  
  <p><em>Edit - I need a raw dump of the file, I cant attach the file (Webhost says nay!), and im not looking for anything specific inside it</em></p>