views:

297

answers:

0

I am trying to allow my custom assembly to utilize the Report Server's web.config file during report rendering. Currently, the custom assembly code can access the ConnectionStrings and AppSettings from the web.config, but when I try to access customer config setting via System.Configuration.ConfigurationManager.GetSection("") I get a type initialization failure. I have added security permissions before each call to GetSection but I still have not had any luck.

System.Configuration.ConfigurationPermission permissions = new ConfigurationPermission(System.Security.Permissions.PermissionState.Unrestricted);

        permissions.Assert();

I have also added my assemblies to the ssrvpolicy.config's code groups.

<CodeGroup
       class="FirstMatchCodeGroup"
       version="1"
       PermissionSetName="FullTrust"
       Name="MyCustomAssemblyCodeGroup"
       Description="A special code group for my custom assembly.">
       <IMembershipCondition
       class="UrlMembershipCondition"
       version="1"
       Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\BLL.dll"/>
      </CodeGroup>    
      <CodeGroup
       class="FirstMatchCodeGroup"
       version="1"
       PermissionSetName="FullTrust"
       Name="MyCustomAssemblyCodeGroup2"
       Description="A special code group for my custom assembly.">
       <IMembershipCondition
       class="UrlMembershipCondition"
       version="1"
       Url="C:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services\ReportServer\bin\DAL.dll"/>
      </CodeGroup>

Has anyone here had any luck attempting what I am trying here? Like I said, I am able to see the ConfigurationManager.ConnectionStrings and ConfigurationManager.AppSettings, but no configSections settings.

Thanks, Chris