I have an application that behaves strangely and just for verification, I would like to see in which security zone it is currently working.
I found the System.Security.SecurityZone enumeration, but cannot find anything that will return from which I am running.
Does anyone have any tips?
Basically I want to find out if my application works on MyComputer, Intranet, Internet, Untrusted, Trusted, etc.
Edit: Here is a small test application that I wrote to find this code, thanks @blowdart .
using System; using System.Reflection; namespace zone_check { class Program { static void Main(string[] args) { Console.WriteLine(".NET version: " + Environment.Version); foreach (Object ev in Assembly.GetExecutingAssembly().Evidence) { if (ev is System.Security.Policy.Zone) { System.Security.Policy.Zone zone = (System.Security.Policy.Zone)ev; Console.WriteLine("Security zone: " + zone.SecurityZone); break; } } } } }
Lasse Vågsæther Karlsen
source share