What is the purpose of the following piece of code?:
object[] hostEvidence = {new Zone(SecurityZone.Internet)};
Evidence internetEvidence = new Evidence(hostEvidence, null);
AppDomain myDomain = AppDomain.CreateDomain("MyDomain");
myDomain.ExecuteAssembly("SecondAssembly.exe", internetEvidence);
As far as I know the CLR automatically (It asks Windows for it) assigns the Zone depending on where the assembly is run from (local machine, internet ect...). I am guessing that it was meant to decrease the permissions for the assembly but when we have two evidences we also have two code groups which are summed within a given policy level.
Kind Regards PK
According to the .NET Framework foundation book (I've not yet quite memorised it for the exam), Evidence is either user specified (.NET Configuration Tool) or Developer specified. So in this way you are explicitly defining the Zone that you need.
I'm not aware of the CLR automatically assigning zones though I might be wrong.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With