Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I am trying to use a legacy C++ dll that has around 5 C/C++ dependencies in SharePoint. I created a wrapper for the dll and it works fine in a test desktop program. I added the wrapper and all C++ libraries to the event receiver assembly and they are being deployed to the WebApplication target. When I run the receiver I get

SecurityException was unhandled by user code System.Security.Permission.SecurityPermission

when it hits the C++ method.

Next, I tried using SPSecurity.RunWithElevatedPrivileges() in the wrapper but I get

SecurityException was unhandled by user code Microsoft.SharePoint.Security.SharePointPermission`.

How can I get the C++ library to work?

share|improve this question
    
Can you post a little more code, like exactly how you are using SPSecurity.RunWithElevatedPrivileges() –  Dave Wise Feb 21 '13 at 19:30
add comment

1 Answer

up vote 2 down vote accepted

This isn't a SP security issue, it's a file system security issue. Make sure the identity running this code has permissions to read the file system.

Source

Make sure your C++ library has sufficient file permissions so that SharePoint can access it. You can match permissions with your development environment.

Other then that all I can think of is trust levels of your web application, check this link out that is explaining how trust levels are setup in different environment as your development machine web app might have full trust level.

share|improve this answer
    
I worked off your comment and was able to find this which allowed talked about AllowPartiallyTrustedCallers. Calling that assembly along with changing the web.config <trust level='Full'> allowed the dll to execute. Thanks for your help! –  ewokwv Mar 14 '13 at 15:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.