SSRS URL 编码

SSRS URL Encode

我对 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