How do I programmatically add an IP address to the blocked list in Windows Server 2003?
Following on from the general answers in this question:
Blocking access to site by banned IP addresses
and working on a C# ASP.NET MVC stack, how would I pro开发者_高级运维grammatically add IP addresses to the list of banned IP addresses on a Windows Server 2003 firewall?
The use case is that the log files on the web app record attacks on a web site. From the admin page I want to be able to click a button/link and have that IP address added to the blocked list.
Basically what you'll want to do is modify the IPSec policies of Windows. I don't want to duplicate answers here, but take a look at the following threads, which should get you what you need:
- Methods of programatically altering ipsec rules with C#?
- Is there a cmdlet in PowerShell 2 to handle ipsec changes?
精彩评论