C# WebUtility.HtmlEncode at .NET 3.0
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 i开发者_运维知识库s programmed in .NET 3.0.
Is there a simple function to replace the System.Net.WebUtility.HtmlEncode(String);
which works in .NET 3.0?
System.Web.HttpUtility.HtmlEncode exists from 1.1
You can try:
HttpUtility.HtmlEncode(...);
In System.Web.dll
Yes there's HttpServerUtility.HtmlEncode.
精彩评论