c# - Using HttpUtility.HtmlEncode and handling special characters/umlaut etc -


I use HttpUtility.HtmlEncode to sanitize user input to prevent XSS attacks. I am doing My problem is that it converts HtmlEncode special codes such as ü to their html equivalent code. I know what it does and does not encode. Then I need HtmlDecode to display it back to the user properly ü

2 question:

  • How to HtmlEncode determines that it is not ü and other Unicode characters like standard Greek alphabet characters. Does HtmlEncode encode all non ascii characters? What is the best way to stop script tags but allow special characters such as umlauts without a special unknown list?

  • Exposes a risk by using HtmlDecode This is potentially changing the malicious javascript

    1. HTMLEncode () is the main thing:
      1. it handles any such characters Which are not part of the default 127 ASCI characters.
      2. It encodes the character, which can be interpreted incorrectly by the browser as valid HTML, CSS or Javascript, to prevent both webpage crashed and deliberately.
    2. Is it dangerous to use? Everything can be dangerous to use it, depending on how you use it, the question is not as much as "are you decoding"? Rather, "Are you decoding user data?" What you do with the result can definitely be dangerous to use, even by displaying it in the client, XSS may be the reason.

    The FAR to be told about encoding and decoding is high, which I can write here, and people have consolidated it in front of me that I can tell you I can That's what XSS is and how you can stop it.


    Comments

    Popular posts from this blog

    HTML/CSS - Automatically set height width from background image? -

    php - Mysql Show Process - Sleep Commands and what to do -

    c - What is the address of buf (the local variable in the main function)? -