html_entity_decode() in asp.net ?

Last post 05-11-2008 9:21 AM by XIII. 3 replies.

Sort Posts:

  • html_entity_decode() in asp.net ?

    05-10-2008, 6:40 AM

    What's the C# variant of html_ entity_ decode()  and htmlentities() ?

     

    Kind Regards,

    Joeri Pansaerts.

    From Bruges, Belgium :)
  • Re: html_entity_decode() in asp.net ?

    05-10-2008, 8:32 AM
    Answer
    • Loading...
    • XIII
    • Joined on 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 9,823
    • Moderator
      TrustedFriends-MVPs

    Hi,

    I think you're looking for

    Server.HtmlDecode method and the Server.HtmlEncode method.

    Grz, Kris.

     

    Read my blog | Members are volunteers so please keep out the (it's urgent | asap | reply me directly) stuff. Nobody's interested in that.
  • Re: html_entity_decode() in asp.net ?

    05-11-2008, 1:15 AM

    Thank you Kris

    Do you know also a way to parse html into the database from a textbox ? Because now I get an application error that there is an attempt to hacking en bla bla bla ... . So I taught I decode the text into html variants (like in PHP) ... but that doesn't work Big Smile

    Kind Regards,

    Joeri Pansaerts.

    From Bruges, Belgium :)
  • Re: html_entity_decode() in asp.net ?

    05-11-2008, 9:21 AM
    • Loading...
    • XIII
    • Joined on 07-01-2002, 3:59 AM
    • Essen, Belgium
    • Posts 9,823
    • Moderator
      TrustedFriends-MVPs

    Ah ok, I see the problem, or at least I think I do Wink.

    ASP.NET by nature has some security settings enabled by default that prevent XSS attacks on your webserver. You can however turn this off, so you can insert html elements in your textbox, by setting the ValidateRequest property of the page to false. I encourage you to do this only on pages where you need admin privileges so that not everyone can start typing in stuff to bring down your site.

    Grz, Kris.

    Read my blog | Members are volunteers so please keep out the (it's urgent | asap | reply me directly) stuff. Nobody's interested in that.
Page 1 of 1 (4 items)
Microsoft Communities
Page view counter