Click here to Skip to main content
15,902,275 members

Comments by Member 11546513 (Top 2 by date)

Member 11546513 21-Apr-15 8:31am View    
Hi, I want to enable firewall port programatically in c# asp.net.

web.config code:
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedprivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Manifest Options
If you want to change the Windows User Account Control level replace the
requestedExecutionLevel node with one of the following.

<requestedexecutionlevel level="asInvoker" uiaccess="false">
<requestedexecutionlevel level="requireAdministrator" uiaccess="false">
<requestedexecutionlevel level="highestAvailable" uiaccess="false">

Specifying requestedExecutionLevel node will disable file and registry virtualization.
If you want to utilize File and Registry Virtualization for backward
compatibility then delete the requestedExecutionLevel node.
-->

<requestedexecutionlevel level="asInvoker" uiaccess="false">

</trustInfo>


.cs code:

private void btnfire_Click(object sender, EventArgs e)
{
Process proc = new Process();
string top = "netsh.exe";
proc.StartInfo.Arguments = "Firewall set opmode enable";
proc.StartInfo.FileName = top;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
}
I am getting an error shown in the below line.
Error 8 Unrecognized configuration section trustInfo. C:\Users\MNKPC-02\Documents\Visual Studio 2013\WebSites\FirewallSettings\Web.config 14
Member 11546513 21-Apr-15 8:05am View    
can you share your source code..? actually i wanted enable windows firewall port programmatically in c# asp.net
My email id:kamalahanchinal58@gmail.com