Created
September 20, 2014 14:51
-
-
Save vendettamit/1ea2be1d8c97f78c3933 to your computer and use it in GitHub Desktop.
Creating custom AppDomain
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DomainController | |
{ | |
public void CreateDomain() | |
{ | |
string pathToDlls = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); | |
Trace.WriteLine(AppDomain.CurrentDomain.FriendlyName); | |
AppDomainSetup domainSetup = new AppDomainSetup { }; | |
domainSetup.ApplicationBase = pathToDlls; | |
this.testDomain = AppDomain.CreateDomain(Guid.NewGuid().ToString(), null, domainSetup, this.GetPermissionSet()); | |
} | |
private PermissionSet GetPermissionSet() | |
{ | |
// create an evidence of type zone | |
var ev = new Evidence(); | |
ev.AddHostEvidence(new Zone(SecurityZone.MyComputer)); | |
// return the PermissionSets specific to the type of zone | |
return SecurityManager.GetStandardSandbox(ev); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment