【问题标题】:SSRS URL EncodeSSRS URL 编码
【发布时间】:2015-09-23 20:11:38
【问题描述】:

我对 SSRS 中的表达式有疑问

项目

使用 SSRS 表达式和自定义代码进行加密,然后确定 基于环境的目标超链接。

我们取得的成就

我们使用导入到 报表属性中的引用

然后我们从表达式中编写 Switch 语句来确定 目标如下:

表达式

=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 的加密部分进行编码。但我对这需要在哪里发生有点困惑。

所以我的理解是我需要从表达式中执行此操作,因为这是我们引用它的地方。如果这不是它发生的地方,那么在上述函数中引用一个参数之前的语法会是什么样子?

有人做过吗?非常感谢您的帮助。

【问题讨论】:

  • 有什么问题?看起来它应该可以工作。您的加密 MemberID 将被添加到带有 SWITCHExpression 中使用的任何 URL。
  • 我需要在加密之前对字符串进行编码。 @汉诺威拳头

标签: vb.net reporting-services ssrs-2012 ssrs-expression


【解决方案1】:

在 VB.net 中,您应该能够在加密之前使用System.Uri.EscapeDataString 对数据进行编码。像这样的:

Public Function EncryptRin(ByVal Rin as string) As String
    Return Encryption.AESConsole.EncryptText(Uri.EscapeDataString(Rin))
End Function

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-03
    • 2011-08-19
    • 1970-01-01
    • 2011-09-20
    • 2010-11-20
    相关资源
    最近更新 更多