title: How to revert an HttpError ConfigurationElement back to "Inherited" using IIS 7 API
body: <p>Suppose I have the following <code>&lt;httpErrors&gt;</code> collection in a <code>web.config</code>:</p>
  
  <pre><code>&lt;httpErrors&gt;
  &lt;/httpErrors&gt;
  </code></pre>
  
  <p>Yep, nice 'n empty.</p>
  
  <p>And in IIS 7, my HTTP errors page looks like this:</p>
  
  <p><img src="https://i.stack.imgur.com/EBcgJ.png" alt="httpErrors"></p>
  
  <p>Beautiful! (I've highlighted 404 simply because that's the example I'll use in a sec).</p>
  
  <p>Now, I run the following code:</p>
  
  <pre><code>errorElement["statusCode"] = 404;
  errorElement["subStatusCode"] = -1;
  errorElement["path"] = "/404.html";
  httpErrorsCollection.Add(errorElement);
  </code></pre>
  
  <p>Lovely. I now have, as expected this in my <code>web.config</code>:</p>
  
  <pre><code>&lt;httpErrors&gt;
      &lt;remove statusCode="404" subStatusCode="-1" /&gt;
      &lt;error statusCode="404" subStatusCode="-1" prefixLanguageFilePath="" path="/404.html" /&gt;
  &lt;/httpErrors&gt;
  </code></pre>
  
  <p>Couldn't be happier. Now, in IIS 7 my HTTP errors section looks, as expected, like below:
  <img src="https://i.stack.imgur.com/Z3utD.png" alt="alt text"></p>
  
  <p>Life couldn't be sweeter at this point. Now, down the line, I want to programmatically revert my 404 error back to the state shown in the original screenshot. Logic dictates that I should <code>remove</code> my new error:</p>
  
  <pre><code>httpErrorsCollection.Remove(errorElement);
  </code></pre>
  
  <p>But alas, if I do this, my <code>web.config</code> looks a lot like this:</p>
  
  <pre><code>    &lt;httpErrors&gt;
          &lt;remove statusCode="404" subStatusCode="-1" /&gt;
      &lt;/httpErrors&gt;
  </code></pre>
  
  <p>And my IIS looks a bit like this:</p>
  
  <p><img src="https://i.stack.imgur.com/TsxQg.png" alt="alt text"></p>
  
  <p>This is expected because of my <code>web.config</code> - but how, using <code>ServerManager</code> and all it's useful IIS 7 API, do I remove the <code>httpError</code> element entirely and revert my <code>web.config</code> back to:</p>
  
  <pre><code>&lt;httpErrors&gt;
  &lt;/httpErrors&gt;
  </code></pre>
  
  <p>Any ideas?</p>