CHAPTER 7 USING CUSTOM .NET CODE WITH REPORTS
Listing 7-4. 'ranting FullTrust Permission to the Custom AssemblY for both SSRS and Visual Studio
<CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="EmployeePayCodeGroup"
Description="Employee Cost Per Visit">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:\Program Files\Microsoft SQL Server\MSRS11.MSSQLSERVER\Reporting
Services\ReportServer\bin\Employee.dll "/>
</CodeGroup>
Or, for Visual Studio:
<CodeGroup class="UnionCodeGroup" version="1"
Permissi onSetName="FullTrust"
Name="Em ployeePayCodeGroup"
Description="Employee Cost Per Visit">
<IMember shipCondition
class="U rlMembershipCondition" version="1"
url="C:\ Program Files (x86)\Microsoft Visual Studio
10.0\Common7\IDE\PrivateAssemblies\Employee.dll"/>
</CodeGroup>
Note If you run your report and see #Error text in a textbox instead of the expected result, it is more than likely
a permission problem of some kind.
Because it’s generally not a good idea to grant your assemblies FullTrust unless absolutely
necessary, you can use named permission sets to grant your custom assembly just the permissions it
needs rather than FullTrust.
To grant the custom assembly just enough permission to read the data files called C:\Temp\
EmployeePay.xml and C:\Temp\EmployeePay.xsd, you first need to add a named permission set in the
policy configuration file rssrvpolicy.config that grants read permission to the files. This will be placed
into the configuration file in the NamedPermissionSets section. You can then apply the specific
permission sets to the custom assembly, as shown in Listing 7-5.