convert < and > to &lt; and &gt; in vb.net

tags, vb.net

Solution

`HttpUtility.HtmlEncode` will do the trick.

From MSDN:

Converts a string into an HTML-encoded string.

One overload can be used like this:

var html = HttpUtility.HtmlEncode(myStringToEncode);

Problem

i have this string ``` <PARAMETERS zone = "6" check_in = "2012-07-01" check_out = "2012-07-02"> <ROOMS> <ROOM adults = "2" children = "0"/> </ROOMS> </PARAMETERS> ``` And i want to obtain this other in vb.net ``` &lt;PARAMETERS zone = "6" check_in = "2012-07-01" check_out = "2012-07-02"&gt; &lt;ROOMS&gt; &lt;ROOM adults = "2" children = "0"/&gt; &lt;/ROOMS&gt; &lt;/PARAMETERS&gt; ``` Someone knows if exists a function to do it directly? Thanks.

Original source