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



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

i'm using httputility.htmlencode sanitise user input prevent against xss attacks. problem htmlencode converts special characters ü html equivalent code. can't find documentation , doesn't encode. in order display correctly user need htmldecode it.

2 questions:

how htmlencode decide needs encode supposedly valid character ü , not other unicode characters standard english language alphabet characters. htmlencode encode non ascii characters? best way prevent script tags allow special characters umlauts without creating special ignore list?

does using htmldecode expose risk converting potentially malicious javascript

htmlencode() 2 main things: it handles characters aren't part of default 127 ascii characterset. it encodes characters misinterpreted browser beingness valid html, css or javascript, prevent both accidental , intentional altering of webpage. is unsafe use? can unsafe use, depending on how utilize it. question not much "are decoding?" rather "are decoding user data?". can unsafe use, depending on result. displaying client can cause xss.

there far more told encoding , decoding can write in here, , people before me have explained far more exhaustive can. this article on preventing xss in asp.net can explain xss , how can prevent it.

c# asp.net utf-8 ascii html-encode

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -