1

According to this table, I need to Encode a string in C# the following way: Only encode the characters that have an HTML Name, with their HTML Name from the table in the link (and the symbols that do NOT have HTML Name should stay the same and not replaced with their HTML Number).

for example: I want the string & ' to be encoded to & ', but the results I am getting are giving & ', it is converting a symbol that also does not have a HTML Name.

HttpUtility.HtmlEncode();

is encoding to both HTML Name and HTML Number..

UPDATE: trying to use Microsoft.Security.Application.Encoder.HtmlEncode (link) is giving also the same encoding results.

Any suggestions for other solution?

Community
  • 1
  • 1
user3795356
  • 43
  • 1
  • 5

1 Answers1

0

Any suggestions for other solution or a way to implement Microsoft.Security;?

Have you tried adding the System.Security dll manually?

References folder in the solution, rightclick, Add Reference.., Assemblies, Framework, browse to System.Security, check the box and press OK.

Now you should be able to add:

using System.Security

at the top of your C# file.

MeanGreen
  • 3,098
  • 5
  • 37
  • 63