title: How to block specified IP address programmatically in c#
body: <p>I want to block the IP address for a specified range. I have written the code in the web.config file as:</p>
  
  <pre><code>&lt;system.webServer&gt;
    &lt;modules runAllManagedModulesForAllRequests="true"/&gt;
    &lt;security&gt;
      &lt;ipSecurity allowUnlisted="false"&gt;&lt;/ipSecurity&gt;
    &lt;/security&gt;
  &lt;/system.webServer&gt;
  </code></pre>
  
  <p>Which will block everything.</p>
  
  <p>But when I run this code nothing getting blocked.</p>