Get my application to be allowed access through firewall using c#

前端 未结 4 1835
失恋的感觉
失恋的感觉 2021-01-24 09:10

i am trying to get my application to be allowed through firewall, as I have to do ftp in active and passive mode is not an option as servers are not configured for that. so i tr

4条回答
  •  清歌不尽
    2021-01-24 09:43

    Firewall management is a system level security feature and has to be done outside of user mode application code. Configuration must be done by an administrator.

    It is bad practice to write the code that you wrote and assume that your application will be run as administrator. Even if it is run by an administrator, you now have an application that "does FTP stuff" and "does firewall stuff". No application has ever been written like this.

    You can write code that interacts with the system firewall, and that code must be run with elevated permissions. Typically such "helper applications" are never even created however as Windows (and every other OS) has all the necessary management tools shipped with the OS (i.e. wf.msc).

提交回复
热议问题