如何确定.NET认为我引用的DLL所在的区域?

时间:2012-12-18 21:15:07

标签: c# .net vb.net

我知道在security.config文件中,.NET定义了可用的区域以及适用于每个区域的权限:“FullTrust”,“Internet”等。

假设我有一个我在我的应用程序中引用的DLL,它位于\\someserver\somedir\library.dll。我如何找出.NET认为属于哪个区域?

这是TrustedZoneRestrictedZoneInternet还是Intranet

适用哪些权限?

1 个答案:

答案 0 :(得分:1)

我用过这个来获取过去的区域

using System.Security.Policy;

...

Assembly myAssembly = ...;
var zone = myAssembly.Evidence.GetHostEvidence<Zone>();
Console.WriteLine(zone.SecurityZone);