Deployed Custom Assembly Permissions | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Deployed Custom Assembly Permissions

Hello Again, Having got my custom assembly working I’ve tried to extend it beyound the default execution permissions by adding a function which simply reads an XML file using a parameter returned via my report and display the returned value in a report field. Everything works fine in preview mode but as soon as I deploy it I get an error in the report field. I’ve read up and know you have to extend the assemblies permissions via the rssrvpolicy.config file, which I’ve done by adding the following CodeGroup, which should give my assembly full permissions: <CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="HKCustomFileAccess"
Description="A special code group for my custom assembly to access User XML File.">
<IMembershipCondition
class="UrlMembershipCondition"
Version="1"
Url="C:program FilesMicrosoft SQL ServerMSSQLReporting ServicesReportServerinCustomClassTest.dll"
/>
</CodeGroup> However, I still get an error and can’t find anything wrong with what I’ve done so anybody got any ideas? Many thanks in advance, James
Having struggled with this for a day or so I’ve finally got it working so for those who might also be suffering there are two solutions regarding the rssrvpolicy.config file, and it took a recompile of my custom assembly to finally see the method call work outside preview mode. 1) Add the following: <CodeGroup class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="MyCodeGroup"
Description="">
<IMembershipCondition class="ZoneMembershipCondition"
version="1"
Zone="MyComputer"/>
</CodeGroup> directly under the following node <CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="Execution"
Description="This code group grants MyComputer code Execution permission. ">
<IMembershipCondition
class="ZoneMembershipCondition"
version="1"
Zone="MyComputer"
/> 2) This would be the more acceptable solution since it narrows permissions to your customer assembly alone, add the following: <CodeGroup
class="UnionCodeGroup"
version="1"
Name="SecurityExtensionCodeGroup"
Description="Code group for the sample security extension"
PermissionSetName="FullTrust">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="C:program FilesMicrosoft SQL ServerMSSQLReporting ServicesReportServerinCustomClassTest.dll"
/>
</CodeGroup> directly under the following node <CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust">
<IMembershipCondition
class="UrlMembershipCondition"
version="1"
Url="$CodeGen$/*"
/>
</CodeGroup> If your doing FileIO as I was then you may also need to add the following to your customer assembly just before you attempt to use the file: Dim FileIOperm As New System.Security.Permissions.FileIOPermission(System.Security.Permissions.FileIOPermissionAccess.Read, "C:TestFileUsersClearance.xml")
FileIOperm.Assert() Hope that helps someone, James
]]>