我对 SSRS 中的表达式有疑问
项目
USE SSRS Expressions and custom code to encrypt, and then determine target to hyperlink to based on environment.
我们取得的成就
We have created a custom DLL using a custom library imported into the References in Report properties
From within the Expression then we wrote Switch statement to determine the target as follows:
表达式
=Switch
(
Globals.ReportServerUrl = "https://devportal2.xxx.com/sites/Co" , "https://stage.connect.com/secure/clr/er=" & Code.EncryptRin(Fields!Member_Member_ID_.Value),
Globals.ReportServerUrl = "https://testportal2.xxx.com/sites/Co" , "https://stage.connect.com/secure/clr/er=" & Code.EncryptRin(Fields!Member_Member_ID_.Value),
Globals.ReportServerUrl = "https://stageportal2.xxx.com/sites/Co" , "https://www.connect.com/secure/clr/er=" & Code.EncryptRin(Fields!Member_Member_ID_.Value),
Globals.ReportServerUrl = "https://stageportal2.xxx.com/sites/Co" , "https://www.connect.com/secure/clr/er=" &
Code.EncryptRin(Fields!Member_Member_ID_.Value),true, "https://stage.connect.com/secure/clr/er=" + Code.EncryptRin(Fields!Member_Member_ID_.Value)
)
自定义代码
Public Function UserName()
Try
Return Report.User!UserID
Catch
Return "System"
End Try
End Function
Public Function EncryptRin(ByVal Rin as string) As String
Return Encryption.AESConsole.EncryptText(Rin)
End Function
上面有两个函数,其中一个是不相关的,那就是 Username() 函数。第二个是我们需要编码的部分。
我需要什么帮助
我们需要先对 URL 的加密部分进行编码,然后才能将其发送出去。但我对这需要在哪里发生有点困惑。
所以我的理解是我需要从表达式中执行此操作,因为这就是我们引用它的地方。如果这不是发生的地方,那么在到达表达式之前引用上述函数中的参数的语法会是什么样子?
有人做过吗?非常感谢您的帮助。
最佳答案
在 VB.net 中您应该能够使用 System.Uri.EscapeDataString
在加密之前对数据进行编码。像这样的事情:
Public Function EncryptRin(ByVal Rin as string) As String
Return Encryption.AESConsole.EncryptText(Uri.EscapeDataString(Rin))
End Function
关于vb.net - SSRS URL 编码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32748635/