1

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.

Andre Hofmeister
  • 3,185
  • 11
  • 51
  • 74

1 Answers1

1

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/

Amit Kumawat
  • 186
  • 3
  • I have never tried it with SPProxyOperation. I will try it tomorrow and give you feedback if its work. – Andre Hofmeister Oct 14 '11 at 17:18
  • Okay, it doesn’t work :(. I also tested it with a standard web part. Here the connection works without any problems. I will let you know, if there is something new. – Andre Hofmeister Oct 17 '11 at 11:55