title: IP Security in Asp.Net Core
body: <p>I am trying to restrict a site by IP address. In previous MVC versions I'd add something like the following to the web.config:</p>
  
  <pre><code>&lt;security&gt;
    &lt;ipSecurity allowUnlisted="false" denyAction="NotFound"&gt;
      &lt;add allowed="true" ipAddress="XX.XX.XX.XX" subnetMask="255.255.255.0"/&gt;
    &lt;/ipSecurity&gt;
  &lt;/security&gt;
  </code></pre>
  
  <p>But adding this to a AspNetCore project causes the application to fails on startup with the error </p>
  
  <blockquote>
    <p>Unable to start process  The web server request failed with status code 500, internal server error</p>
  </blockquote>
  
  <p>Evidently I broke the config as its not handled in here anymore. The error produces a HttpFailure log, which looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/tHWVy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/tHWVy.png" alt="enter image description here"></a></p>
  
  <p>What's the best way to handle this now, something built-in or otherwise</p>