SSIS:在脚本任务中对 URL 进行 HTML 编码

发布于 2024-08-08 14:19:02 字数 319 浏览 1 评论 0原文

我想在 C# SSIS 脚本任务中对 URL 进行 URL 编码。我尝试过使用 System.Web.HttpServerUtility,但智能感知显示它似乎不知道“服务器”。下面是引发错误的代码示例:

Import System.Web
...
...
...
Server.HtmlEncode(TestVariable);

我已经通过编写一个函数来解决这个问题,该函数查找并替换字符串中的字符以模仿 HTML 编码字符串,但老实说我讨厌这个解决方案。我真的只是想找出我需要什么不同的方式来使用 .NET 中的内容,而不是重新发明 HTML 编码器轮。

I would like to URL encode a URL in a C# SSIS script task. I have tried using System.Web.HttpServerUtility, but intellisense shows it doesn't seem to be aware of "Server". Here's an example of the code that's raising an error:

Import System.Web
...
...
...
Server.HtmlEncode(TestVariable);

I have worked around this issue by writing a function that finds and replaces characters in a string to mimic HTML encoding a string, but I honestly abhore the solution. I would really just like to find out what I need to differently to use what's baked into .NET instead of reinventing the HTML Encoder wheel.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

断念 2024-08-15 14:19:02

您需要添加对程序集 System.Web 的引用

You need to add a reference to the assembly System.Web

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文