Forum Discussion
the custom code in paginated report in report server not working
Hi,
I custom a function in my report builder which can get response json from other server and generate a new url for me. my code is like this:
Function Div_RT(ByVal DR As String) As String
Dim request_bbox As System.Net.HttpWebRequest
Dim response_bbox As System.Net.HttpWebResponse = Nothing
Dim reader_bbox As System.IO.StreamReader
Dim DR2 as String = Replace(DR, ",","_")
Dim getbbox_url as String
getbbox_url ="http://XXXXXXXXXXXXXXX"
request_bbox = DirectCast(request_bbox.Create(getbbox_url), System.Net.HttpWebRequest)
response_bbox = DirectCast(request_bbox.GetResponse(), System.Net.HttpWebResponse)
reader_bbox = New System.IO.StreamReader(response_bbox.GetResponseStream())
Dim rawresp As String
rawresp = reader_bbox.ReadToEnd()
Dim s As String
s = Mid(rawresp, InStr(rawresp, "map_get_extent_linkids")+25, InStr(rawresp, "}}]")-InStr(rawresp, "map_get_extent_linkids")-26)
Dim divrt as String
divrt ="http://XXXXXXXXXXXXXXXXXXXXXXXX"
Div_RT=divrt
End Function
I test this function in my local which can work well( cuz I change the "RSPreviewPolicy" file under C:\Program Files (x86)\Microsoft Report Builder. I update PermissionSetName="FullTrust" instead if "Execution"
<CodeGroup
class="UnionCodeGroup"
version="1"
PermissionSetName="FullTrust"
Name="Report_Expressions_Default_Permissions"
Description="This code group grants default permissions for code in report expressions and Code element. ">
<IMembershipCondition
class="StrongNameMembershipCondition"
version="1"
PublicKeyBlob="0024000004800000940000000602000000240000525341310004000001000100512C8E872E28569E733BCB123794DAB55111A0570B3B3D4DE3794153DEA5EFB7C3FEA9F2D8236CFF320C4FD0EAD5F677880BF6C181F296C751C5F6E65B04D3834C02F792FEE0FE452915D44AFE74A0C27E0D8E4B8D04EC52A8E281E01FF47E7D694E6C7275A09AFCBFD8CC82705A06B20FD6EF61EBBA6873E29C8C0F2CAEDDA2"
/>
</CodeGroup>
then I publish this report to power bi report server, the function cannot work again. so I update the "rssrvpolicy" file under C:\Program Files\Microsoft Power BI Report Server\PBIRS\ReportServer. I update PermissionSetName="FullTrust" instead if "Execution"
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" Name="Report_Expressions_Default_Permissions" Description="This code group grants default permissions for code in report expressions and Code element. ">
<IMembershipCondition class="StrongNameMembershipCondition" version="1" PublicKeyBlob="0024000004800000940000000602000000240000525341310004000001000100512C8E872E28569E733BCB123794DAB55111A0570B3B3D4DE3794153DEA5EFB7C3FEA9F2D8236CFF320C4FD0EAD5F677880BF6C181F296C751C5F6E65B04D3834C02F792FEE0FE452915D44AFE74A0C27E0D8E4B8D04EC52A8E281E01FF47E7D694E6C7275A09AFCBFD8CC82705A06B20FD6EF61EBBA6873E29C8C0F2CAEDDA2" />
</CodeGroup>
but it does not work in power bi report server. I also restart the server. can you help to check how can I make this function work?@
2 Replies
- v-henryk-mstf
Community Support
Hi Tengmin123 ,
I can't reproduce your problem at the moment, refer to the following documents and blogs to see if they can help you.
Power BI Paginated Reports with Custom Code (VB Co... - Microsoft Power BI Community
Paginated reports in Power BI: FAQ - Power BI | Microsoft Docs
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- Tengmin123Frequent Visitor
Hi, v-henryk-mstf
Thank you for your reply. but actully, my custom code can work well in report builder. but when I upload it to power bi report server. it cannot get response from outsource web page. therefore the function cannot work. I guess it is caused by report server configuration issue. do you have any idea about this?
Regards,
Tengmin