user4394891
user4394891

Reputation:

Ban IP Address From Constantly Hitting My C# / Azure Website?

There is a plug-in for WordPress (sorry, I forget the name) which allows me to automatically ban or throttle an IP address if they are accessing pages too quickly, such as 1 page per second.

I have a problem on a C# website I have written hosted on Azure because someone in France is slamming my site every 1 second. It's been going on a couple of weeks and it's getting a tad annoying.

Is there something very simple available for C# or Azure which is equivalent to the WordPress plug-in which allows me to automatically ban or throttle an IP Address?

Thank you

Upvotes: 3

Views: 963

Answers (1)

Kien Chu
Kien Chu

Reputation: 4895

You can configure to block requests from IP addresses when the total number of requests observed within the time window defined by requestIntervalInMilliseconds exceeds the value set in the maxRequests attribute.

<system.webServer>
    <security>
      <dynamicIpSecurity>
        <denyByRequestRate enabled="true" maxRequests="10" requestIntervalInMilliseconds="1000"/>
      </dynamicIpSecurity>
    </security>
  </system.webServer>

Source: https://azure.microsoft.com/en-us/blog/confirming-dynamic-ip-address-restrictions-in-windows-azure-web-sites/

Upvotes: 11

Related Questions