nerdexam
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)
  • A
    7% (4)
  • B
    12% (7)
  • C
    4% (2)
  • D
    77% (44)

Community Discussion

No community discussion yet for this question.

Full 70-515 Practice