What is the correct way to invoke unmanaged code, such as a COM API, through .Net interaction from code that runs in a partially trusted environment?
When developing ASP.Net WebPart for Microsoft SharePoint, I had to communicate with another system through the COM API. I solved this problem temporarily by completely changing the permissions of SharePoint. Later, I clarified this by performing user security on top of the minimum settings that grant SharePoint UnmanagedCode permission, but this is not so important as unmanaged code may skip the rest of the CAS.
From what I have assembled, I probably need a fully trusted assembly that allows partial trust to callers and acts as a level between managed and unmanaged domains. In addition, I would suggest that there is a need for some additional settings that allow partially trusted code to fully trust code without fully trusted code that suffers from partially trusted code permissions.
So what is the right way and how to put it into practice?
source
share