Microsoft
70-515 · Question #163
You are implementing a Web page that displays text that was typed by a user. You need to display the user input in the Web page so that a cross-site scripting attack will be prevented. What should…
The correct answer is D. Call HttpUtility.HtmlEncode. See the full explanation below for the reasoning.
Question
You are implementing a Web page that displays text that was typed by a user. You need to display the user input in the Web page so that a cross-site scripting attack will be prevented. What should you do?
Options
- ACall document.write.
- BCall Response.Write.
- CCall HttpUtility.UrlEncode.
- DCall HttpUtility.HtmlEncode.
How the community answered
(57 responses)- A7% (4)
- B12% (7)
- C4% (2)
- D77% (44)
Community Discussion
No community discussion yet for this question.