Question

Hello StackOverflow,

I have an ASP.NET/C# webpage that calls functions from a managed .dll assembly in the code behind. It runs through fine and working on the dev environments, but the production environment skips the functions from the assembly with no exception or logging from what I can see from our internal logging methods. The assembly requires permissions to start a process on the server and use file IO. From reading I see that this appears to have to do with code trust levels, but I have no idea where to start looking to change things in a working direction. How can I check the trust level of the assembly from the context of the server?

Was it helpful?

Solution

This is how you find the application trust of the current domain at run time...

AppDomain.CurrentDomain.ApplicationTrust

The real goodies are here...

AppDomain.CurrentDomain.ApplicationTrust.DefaultGrantSet.PermissionSet

odds are the .IsUnrestricted property on the permssion set is false.

What you do next depends on the Framework version you are targeting. There were some changes made in 4.0 to how all this works.

Here is an overload of information... http://msdn.microsoft.com/en-us/library/dd984947.aspx

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top