.NET 安全策略配置工具

第一个工具是可视化的:控制面板=》管理工具=》.NET Framework 2.0配置

image

第二个工具是命令行的,使用方式是:开始=>所有程序=>Microsoft Visual Studio 2008=>Visual Studio Tools=>Visual Studio 2008 命令提示=>输入 caspol

Microsoft (R) .NET Framework CasPol 2.0.50727.3053
版权所有(C) Microsoft Corporation。保留所有权利。

所请求的“帮助”屏幕

用法: caspol <option> <args> ...

caspol -m[achine]
    使附加的命令作用于计算机级别的修饰符

caspol -u[ser]
    使附加的命令作用于用户级别的修饰符

caspol -en[terprise]
    使附加的命令作用于企业级别的修饰符

caspol -cu
caspol -customuser <path>
    使附加的命令作用于自定义用户级别的修饰符

caspol -a[ll]
    将所有策略级别设置为活动级别

按 <enter> 继续....
caspol -ca
caspol -customall <path>
    使附加的命令作为自定义用户作用于所有级别的修饰符

caspol -l[ist]
    列出代码组和权限集

caspol -lg
caspol -listgroups
    列出代码组

caspol -lp
caspol -listpset
    列出权限集

caspol -lf
caspol -listfulltrust
    列出完全信任程序集

caspol -ld
caspol -listdescription
    列出代码组名称和说明

按 <enter> 继续....
caspol -cft
caspol -checkfulltrust
    检查完全信任列表

caspol -ap
caspol -addpset { <named_xml_file> | <xml_file> <name> }
    将命名权限集添加到策略级别

caspol -cp
caspol -chgpset <xml_file> <pset_name>
    更改活动级别中的命名权限集

caspol -rp
caspol -rempset <pset_name>
    从策略级别移除命名权限集

caspol -af
caspol -addfulltrust <assembly_name>
    将完全信任程序集添加到策略级别

caspol -rf
caspol -remfulltrust <assembly_name>
    从策略级别移除完全信任程序集
按 <enter> 继续....

caspol -rg
caspol -remgroup <label|name>
    移除 <label|name> 处的代码组

caspol -cg
caspol -chggroup <label|name> {<mship>|<pset_name>|<flag>}+
    将 <label|name> 处的代码组更改为给定的成员、
    权限集或标志

caspol -ag
caspol -addgroup <parent_label|name> <mship> <pset_name> <flag>
    将具有给定成员、权限集和
    标志的代码组添加到 <parent_label|name>

caspol -rsg
caspol -resolvegroup <assembly_name>
    列出此文件所属的代码组

caspol -rsp
caspol -resolveperm <assembly_name>
    列出授予此文件的权限

按 <enter> 继续....
caspol -s[ecurity] { on | off }
    打开安全性或关闭安全性

caspol -e[xecution] { on | off }
    启用/禁用代码执行启动时的“运行权限”检查

caspol -pp
caspol -polchgprompt { on | off }
    启用/禁用策略更改提示

caspol -q[uiet]
    对此命令禁用策略更改提示

caspol -r[ecover]
    恢复最近保存的级别版本

caspol -rs
caspol -reset
    将级别重置为它的默认状态

caspol -rsld
caspol -resetlockdown
    将级别重置为默认的锁定状态
按 <enter> 继续....

caspol -f[orce]
    启用将禁用 caspol 功能的强制保存

caspol -b[uildcache]
    生成安全策略缓存文件。

caspol -?
caspol /?
caspol -h[elp]
    显示此屏幕

其中“<mship>”可以是:
  -allcode                 所有代码
  -appdir                  应用程序目录
  -custom <xml_file>       自定义成员条件
  -hash <hashAlg> {-hex <hashValue>|-file <assembly_name>}
                           程序集哈希
  -pub {-cert <cert_file_name> | -file <signed_file_name> | -hex <hex_string>}
                           发行者
  -gac                     已安装在全局程序集缓存中
  -site <website>          站点
按 <enter> 继续....
  -strong {-file <assemblyfile_name> | -hex <public_key>}
          {<name> | -noname} {<version> | -noversion}
                           强名称
  -url <url>               URL
  -zone <zone_name>        区域,其中区域可以是:
                                 MyComputer
                                 Intranet
                                 Trusted
                                 Internet
                                 Untrusted

其中“<flag>”可以是下列项的任意组合:
  -exclusive {on|off}
                           设置策略声明 Exclusive 标志
  -levelfinal {on|off}
                           设置策略声明 LevelFinal 标志
  -n[ame] <name>
                           代码组名称
  -d[escription] <desc>
                           代码组说明

原文地址:https://www.cnblogs.com/chenxizhang/p/1286598.html