Convert string to HTML

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Paul Ritchie

    #1

    Convert string to HTML

    Is there something in .NET that will convert a string so that it can be
    displayed correctly as HTML?

    eg I would like to convert the string "a < b" to "a &#3C; b".

    cheers,
    Paul.




  • Ken Cox [Microsoft MVP]

    #2
    Re: Convert string to HTML

    Hi Paul,

    Try this?

    Server.HtmlEnco de("a < b")

    Gives:

    a &lt; b

    Ken
    MVP [ASP.NET]


    "Paul Ritchie" <REMOVEpritchie @REMOVExtra.REM OVEco.REMOVEnz> wrote in message
    news:O5BuPi2TDH A.3192@tk2msftn gp13.phx.gbl...
    Is there something in .NET that will convert a string so that it can be
    displayed correctly as HTML?

    eg I would like to convert the string "a < b" to "a &#3C; b".

    cheers,
    Paul.





    Comment

    Working...