.NET 3.0 上的 C# WebUtility.HtmlEncode

发布于 2024-10-07 15:59:20 字数 308 浏览 0 评论 0原文

我正在制作一份(表格)申请,可以发送通知邮件。

在我的应用程序中,有两个变量将被放入邮件的 html 正文中。其中一个是数字,第二个是名称,其中可以包含 <;和>人物。

我找到了一个有用的函数来对此进行编码,但是 System.Net.WebUtility.HtmlEncode(String); 仅适用于 .NET 4.0,而我的应用程序是在 .NET 3.0 中编程的。

是否有一个简单的函数可以替换 .NET 3.0 中的 System.Net.WebUtility.HtmlEncode(String); ?

I'm making an (form) application, with the possibility to send a notification mail.

On my application there are two variables, that will be placed into the html body of the mail. One of them is a number, but the second is a name, which can contain the < and > characters.

I found an useful function to encode this, but the System.Net.WebUtility.HtmlEncode(String); only works on .NET 4.0, while my app is programmed in .NET 3.0.

Is there a simple function to replace the System.Net.WebUtility.HtmlEncode(String); which works in .NET 3.0?

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

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

发布评论

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

评论(3

治碍 2024-10-14 15:59:20

System.Web.HttpUtility.HtmlEncode 从 1.1 开始存在

System.Web.HttpUtility.HtmlEncode exists from 1.1

烟酒忠诚 2024-10-14 15:59:20

您可以尝试:

HttpUtility.HtmlEncode(...);

System.Web.dll

You can try:

HttpUtility.HtmlEncode(...);

In System.Web.dll

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