23 March 2011

ASP.NET - Give trust to an assembly

One day SharePoint gave me the exception "Request for the permission of type 'System.Data.Odbc.OdbcPermission...". The sites trust level set in Web.config was:
<trust level="WSS_Minimal" originUrl="" />

Thus I had to edit the WSS_Minimal, the location of which is also indicated in the Web.config. In my case: 14\config\wss_minimaltrust.config.

In this file I added the following line to the SecurityClasses:
<SecurityClass Name="OdbcPermission" Description="System.Data.Odbc.OdbcPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

And this one under PermissionSet:
<IPermission class="OdbcPermission" version="1" Unrestricted="true" />

And I was back in business.

No comments:

Post a Comment