CHAPTER 7 USING CUSTOM .NET CODE WITH REPORTS
- Custom assemblies are granted only Execution permissions by default. Execution
permission allows code to run but not to use protected resources.
To use your custom assemblies with SSRS 2012, you need to take the following steps to place them
in a location where SSRS 2012 can find them and to edit the files that control security policy when
necessary. The location of the files depends on whether you want to use them in the Report Designer
within Visual Studio or on the report server.
- You need to deploy your custom assemblies to the Report Designer and/or
SSRS 2012 applications folder.
- For the Report Designer/Visual Studio, the default is C:\Program Files
(x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies. - For SSRS 2012, the default is C:\Program Files\Microsoft SQL
Server\MSRS11.MSSQLSERVER\Reporting Services\ReportServer\bin.
Note You need to have the necessary permissions to access these folders. By default, members of the standard
Users group won’t have the necessary write/modify permissions on these folders. Logged in as a user with the
appropriate security permissions, such as the administrator, you can set the permissions on the folders to allow
the necessary access to the folders to users logged in under less privileged accounts. Alternately, you could move
the files to the appropriate folders when logged in or running as a user who has the necessary permissions.
- Next, you need to edit the SSRS 2012 security policy configuration files if your
custom assembly requires permissions in addition to the Execution
permission. (For SSRS 2012, the default location is C:\Program Files\Microsoft
SQL Server\MSRS11.MSSQLSERVER\Reporting
Services\ReportServer\rssrvpolicy.config.)
You should update the designer permissions configuration at this point as
well. The default location for this file is C:\Program Files (x86)\Microsoft
Visual Studio 10.0\Common7\IDE\PrivateAssemblies\RSPreviewPolicy.config.
This config file will use a slightly different assembly path than your SSRS
instance, though, since we will be placing the DLL file in the private assemblies
folder for Visual Studio 2010.
For example, if you were writing a custom assembly to calculate an employee’s cost per visit, you
might need to read the pay rates from a file. To retrieve the rate information, you would need to grant
additional security permissions to your custom assembly. To give your custom assembly FullTrust
permission, you can add the XML text shown in Listing 7-4 to the appropriate CodeGroup section of the
rssrvpolicy.config file.