This is my first approach to this library and not sure if I'm missing something else or it's a bug.
I get an UnauthorizedAccessException when adding a new rule.
I'm using version 2.2.0.86
// Create and add rules for this app
try {
string ruleRootName = @"Myapp ";
FirewallProfiles allProfiles = FirewallProfiles.Domain | FirewallProfiles.Private | FirewallProfiles.Public;
string thePath = Assembly.GetExecutingAssembly().Location;
var r1 = FirewallManager.Instance.CreateApplicationRule(allProfiles, ruleRootName + @"Rule (Outbound)", FirewallAction.Allow, thePath);
r1.Direction = FirewallDirection.Outbound;
FirewallManager.Instance.Rules.Add(r1);
}
catch (UnauthorizedAccessException e) {
Utils.LogV("Failed to set firewall rules");
}
This is my first approach to this library and not sure if I'm missing something else or it's a bug. I get an UnauthorizedAccessException when adding a new rule. I'm using version 2.2.0.86
// Create and add rules for this app try { string ruleRootName = @"Myapp "; FirewallProfiles allProfiles = FirewallProfiles.Domain | FirewallProfiles.Private | FirewallProfiles.Public; string thePath = Assembly.GetExecutingAssembly().Location; var r1 = FirewallManager.Instance.CreateApplicationRule(allProfiles, ruleRootName + @"Rule (Outbound)", FirewallAction.Allow, thePath); r1.Direction = FirewallDirection.Outbound; FirewallManager.Instance.Rules.Add(r1); } catch (UnauthorizedAccessException e) { Utils.LogV("Failed to set firewall rules"); }