How to add an application to the firewall exception using C#
This code will help add a given application to the firewall exception
private static void AddAppToFireWall(string ruleName,string applicationPath)
{
string command = string.Format("AdvFirewall Firewall add rule name={0} dir=in program={1} remoteip=localsubnet action=allow",
ruleName,
applicationPath);
Process.Start(new ProcessStartInfo(@"C:\Windows\System32\netsh.exe",command));
}
Wednesday, July 6, 2011
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment