vb.net - SSRS URL 编码

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

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

相关文章:

.net - 如何使用 vb .net 获取系统上的可用内存

vb.net - .Net - 检测外观设置(经典还是 XP?)

reporting-services - SSRS 收集的饼图 - 显示原始百分比

reporting-services - 快速查询在 SSRS 2 中运行缓慢

html - 未安装 excel 时运行 Excel 宏

vb.net - LINQ:排序依据(将字母视为数字)

reporting-services - 处理时的 SSRS ReportViewer nullreference 异常

reporting-services - 保存报告时禁用 where 子句中的查询重写

sql-server - 停止 SQL 报告服务器劫持/报告

reporting-services - SSRS 2012 : Display Parameter Label in Caps