"Jas" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
Unless you have elevated the CAS permissions grant for the trusted zone,
your evidence-reading code won't work in that zone. You'll need to use the
MyComputer zone or add some other evidence that would allow the necessary
permissions to be granted.
First big problem is right here. The instance is getting created in the
original appdomain because that's where the type is defined.
Second big problem is here. The method is being invoked in the original
appdomain because that's where the methodinfo is defined.
You'll need to do two big things differently to get this to work. First,
you'll need to ensure that the HelloWorld object gets created in the new
appdomain. You'll then need to call the method against that remote
instance of the object, not against a local wrapper instance in the original
appdomain. Here's a version that should work:
Evidence myNewEvidence = new Evidence();
AppDomain myNewAppDomain = AppDomain.CreateDomain("new domain",
// The HelloWorld instance will be created in the new appdomain even
though the reference is
// held in the original appdomain:
Hello.HelloWorld helloWorldInstance =
// This will execute in the original appdomain:
// This will execute in the new appdomain: