100165423.htm
来自「C#高级编程(第三版),顶死你们。。 。up」· HTM 代码 · 共 74 行
HTM
74 行
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
14.2 对Framework中安全性的支持
</title></head>
<body>
<div class="area">
<div class="col1">
<div class="lineBlue">
</div>
<!-- title -->
<div class="arcTitle">
<h1>
<a href="../16">
C#高级编程(第3版)【全文连载】
</a>
</h1>
<div style="text-align: center; font-size: 15px">
<a href="100165423.htm">
14.2 对Framework中安全性的支持
</a>
</div>
<div style="text-align: center; font-size: 15px">
<a class="url" href="../../default.htm">http://book.csdn.net/</a>
2006-10-13 14:41:00
</div>
<div style="margin: 0px auto; width: 700px; border: solid 1px #0b5f98;">
<div style="float: left; width: 16px; background-color: #0b5f98; color: White; padding: 1px;">
图书导读
</div>
<div style="float: right; width: 670px; text-align: left; line-height: 16pt; padding-left: 2px">
<!--导读-->
<h1 id="divCurrentNode" style="color: #b83507; width: 100%; text-align: left; font-size: 12px; padding-left: 2px">当前章节:<a href='100165423.htm'><font color='red'>14.2 对Framework中安全性的支持</font></a></h1>
<div id="divRelateNode" style="padding-left: 2px">
<div style='float:left;width:49%'>·<a href='100165420.htm'>14.1.1 代码组</a></div><div style='float:right;width:49%'>·<a href='100165421.htm'>14.1.2 代码访问权限和权限集</a></div><div style='float:left;width:49%'>·<a href='100165422.htm'>14.1.3 策略的级别:Machine、User和Enterprise</a></div><div style='float:right;width:49%'>·<a href='100165424.htm'>14.2.1 要求权限</a></div><div style='float:left;width:49%'>·<a href='100165425.htm'>14.2.2 请求权限</a></div><div style='float:right;width:49%'>·<a href='100165426.htm'>14.2.3 隐式的权限</a></div></div>
</div>
</div>
</div>
<!-- main -->
<div id="main">
<div id="text"> <link href="css.css" rel="stylesheet" type="text/css" /><h3 style="MARGIN-TOP: 11.4pt; MARGIN-LEFT: 0cm; MARGIN-RIGHT: 0cm; FTEL: 11.4pt"><a ftel="_Toc507815603"><span lang="EN-US">14.2 </span></a><span style="FONT-FAMILY: 楷体_GB2312">对</span><span lang="EN-US">Framework</span><span style="FONT-FAMILY: 楷体_GB2312">中安全性的支持</span></h3>
<p class="MsoNormal"><span style="COLOR: black; FONT-FAMILY: 宋体">程序员在使用</span><span lang="EN-US" style="COLOR: black">.NET</span><span style="COLOR: black; FONT-FAMILY: 宋体">的安全性时,必须信任</span><span lang="EN-US" style="COLOR: black">CLR</span><span style="COLOR: black; FONT-FAMILY: 宋体">能够很好地执行安全性策略。当调用的方法需要特定的权限</span><span lang="EN-US" style="COLOR: black">(</span><span style="COLOR: black; FONT-FAMILY: 宋体">例如访问本地磁盘上文件的权限</span><span lang="EN-US" style="COLOR: black">)</span><span style="COLOR: black; FONT-FAMILY: 宋体">时,</span><span lang="EN-US" style="COLOR: black">CLR</span><span style="COLOR: black; FONT-FAMILY: 宋体">将把调用放入堆栈中,以确保调用链上的每一个调用者都能得到它们请求的权限。</span></p>
<p class="MsoNormal"><span style="COLOR: black; FONT-FAMILY: 宋体">此时就要考虑性能了,但为了充分发挥托管环境</span><span lang="EN-US" style="COLOR: black">(</span><span style="COLOR: black; FONT-FAMILY: 宋体">如</span><span lang="EN-US" style="COLOR: black">.NET)</span><span style="COLOR: black; FONT-FAMILY: 宋体">的优点,就必须牺牲一部分性能。另一种方式是不完全可信的程序集可以调用完全可信的程序集,这样,系统将很容易遭到攻击。</span></p>
<p class="MsoNormal"><span style="COLOR: black; FONT-FAMILY: 宋体">为了引用</span><span lang="EN-US" style="COLOR: black">.NET</span><span style="COLOR: black; FONT-FAMILY: 宋体">的安全特性,本章中大多数应用程序要使用</span><span lang="EN-US" style="COLOR: black">.NET Framework</span><span style="COLOR: black; FONT-FAMILY: 宋体">库中的命名</span><span lang="EN-US" style="COLOR: black"> </span><span style="COLOR: black; FONT-FAMILY: 宋体">空间:</span></p>
<p class="1" style="MARGIN-LEFT: 37.55pt; FTEL: -16.1pt"><span lang="EN-US">●<span style="FONT: 7pt "Times New Roman""> </span></span><span lang="EN-US">System.Security.Permissions</span></p>
<p class="1" style="MARGIN-LEFT: 37.55pt; FTEL: -16.1pt"><span lang="EN-US">●<span style="FONT: 7pt "Times New Roman""> </span></span><span lang="EN-US">System.Security.Policy</span></p>
<p class="1" style="MARGIN-LEFT: 37.55pt; FTEL: -16.1pt"><span lang="EN-US">●<span style="FONT: 7pt "Times New Roman""> </span></span><span lang="EN-US">System.Security.Principal</span></p>
<p class="MsoNormal"><span style="FONT-FAMILY: 宋体">注意,基于证据的代码访问安全性是在</span><span lang="EN-US">Windows</span><span style="FONT-FAMILY: 宋体">登录安全性之后进行工作的。如果要运行</span><span lang="EN-US">.NET</span><span style="FONT-FAMILY: 宋体">桌面应用程序,则必须赋予它相关的</span><span lang="EN-US">.NET</span><span style="FONT-FAMILY: 宋体">代码访问安全性权限。但是,已登录的用户也必须是</span><span lang="EN-US">Windows </span><span style="FONT-FAMILY: 宋体">账户的用户,才有执行代码的权限。对于桌面应用程序而言,这意味着当前的用户必须被赋予相关的权限,才能访问磁盘上相关的程序集文件。对于</span><span lang="EN-US">Internet</span><span style="FONT-FAMILY: 宋体">应用程序而言,运行</span><span lang="EN-US">Internet Information Server</span><span style="FONT-FAMILY: 宋体">的账户必须能够访问程序集文件。</span></p></div>
<!-- page -->
<div class="page" style="text-align: center">
<a href="100165422.htm">上一页</a> <a href="index.html">首页</a> <a href="100165424.htm">下一页</a>
</div>
<div style="margin: 0px auto; width: 700px; border: solid 1px #0b5f98;">
<div style="float: left; width: 16px; background-color: #0b5f98; color: White; padding: 1px;">
图书导读
</div>
<div style="float: right; width: 670px; text-align: left; line-height: 16pt; padding-left: 2px">
<!--导读-->
<h1 id="divCurrentNode2" style="color: #b83507; width: 100%; text-align: left; font-size: 12px; padding-left: 2px">当前章节:<a href='100165423.htm'><font color='red'>14.2 对Framework中安全性的支持</font></a></h1>
<div id="divRealteNod2" style="padding-left: 2px">
<div style='float:left;width:49%'>·<a href='100165420.htm'>14.1.1 代码组</a></div><div style='float:right;width:49%'>·<a href='100165421.htm'>14.1.2 代码访问权限和权限集</a></div><div style='float:left;width:49%'>·<a href='100165422.htm'>14.1.3 策略的级别:Machine、User和Enterprise</a></div><div style='float:right;width:49%'>·<a href='100165424.htm'>14.2.1 要求权限</a></div><div style='float:left;width:49%'>·<a href='100165425.htm'>14.2.2 请求权限</a></div><div style='float:right;width:49%'>·<a href='100165426.htm'>14.2.3 隐式的权限</a></div></div>
</div>
</div>
</div>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?