简体   繁体   English

.net中的代码访问安全性实时实现?

[英]Code Access Security real time implementation in .net?

I am a C# .net devoloper. 我是C#.net devoloper。

I have read a lot about Code Access Security(CAS) in .net. 我已经阅读了很多有关.net中的代码访问安全性(CAS)的信息。

I haven't seen the implementation of this featue on any of the project i have worked on? 我没有在我从事过的任何项目中看到此功能的实现?

Has anyone implemented it? 有人实施过吗?

I read that ALL managed code targetsthe CLR will recieves the benefit of CAS. 我了解到,所有托管代码目标都将使CLR受益于CAS。

What all scenarios we explicitly use code access security in real time? 我们在所有明确场景中实时使用代码访问安全性的所有方案是什么?

Thanks 谢谢

SC SC

CAS simply prevents untrusted code from doing something you don't want it to do to a resource you might want to protect. CAS只是阻止不受信任的代码对您可能想要保护的资源执行您不希望执行的操作。

I think the classic example of where it's required is an untrusted program attempting to access resources on your local PC. 我认为最典型的例子是试图访问您本地PC上的资源的不受信任的程序。 In such a case, you can use CAS to grant permissions to this program to do what it needs to do. 在这种情况下,您可以使用CAS授予对此程序执行其所需操作的权限。

I've personally used CAS to grant permissions to a set of (.NET 1.1 and 2.0) applications running from our intranet. 我亲自使用CAS来授予从我们的Intranet运行的一组(.NET 1.1和2.0)应用程序的权限。 These programs might need to perform IO on the workstations running them. 这些程序可能需要在运行它们的工作站上执行IO。 Without CAS, I'd get security exceptions when attempting these operations. 没有CAS,尝试这些操作时会出现安全异常。

You might want to check out this article: Understanding .NET Code Access Security 您可能想看看这篇文章: 了解.NET代码访问安全性

The article does a better job of explaining this than I did. 这篇文章比我做得更好。 It also walks you through setting it up. 它还会引导您进行设置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM