SqlClientPermission in a sandbox web part

829 views Asked by At

I'm trying a long time to get a working SQL connection in my web part. I read a lot of msdn stuff and tried many things, but I can't get it working... Every time I try to open a SQL connection, my web part throw an exception: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission.

I tried custom.configs which set the .net trust higher, edit the manifest, set the permissions with the PermissionSet-Class and also tried FullTrust, but nothing worked. How do I set the permission correctly? Btw, the web part is a sandbox solution.

It would be awesome if someone could give me a detailed view, how to set the permissions.

1

There are 1 answers

2
Amit Kumawat On BEST ANSWER

For this kind of operation, You need to develop a full trust proxy(SPProxyOperation) to be used by your Sandbox Solutions.

The sandbox solutions has Code Access Security and Permission restrictions. For details you can visit: http://extreme-sharepoint.com/2011/10/07/sharepoint-sandbox-reallly-new-feature/