do we need to escape the character '<'

Posted by Ozkan on Stack Overflow See other posts from Stack Overflow or by Ozkan
Published on 2011-06-21T13:57:43Z Indexed on 2011/06/21 16:22 UTC
Read the original article Hit count: 219

Filed under:
|
|

In C# ASP.NET, if we have the characters < or > in a string. Do we need to escape it like:

string a = "\<test\>abcdef\</test\>"

because this string will be send to an external method via webservices. And in that method, it will be converted to a some kind of xml file.

contentHtml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>" + contentHtml;
content_ws.AddContent(contentHtml);
//AddContent() method is a external method (via webservices)

Thx for help

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET