You are designing an ASP.NET Web application.
A page of the Web application will allow users to post comments and view comments posted by other users.
You need to recommend an approach for preventing the Web application from storing malicious content.
What should you recommend?
A.
In the page code-behind, add a Validation attribute.
B.
In the page code-behind, add a ValidateInput attribute.
C.
On the page, set the ValidateRequest property of the @ Page directive to false.
Use the HtmlEncode() method on submitted content before storing the content in the database.
D.
On the page, set the ValidateRequest property of the @ Page directive to false.
Use the HtmlAttributeEncode() method on submitted content before storing the content in the database.
Explanation:
ValidateRequest
Gets or sets a value that determines whether ASP.NET examines input from the browser for dangerous values.
http://msdn.microsoft.com/en-us/library/system.web.configuration.pagessection.validaterequest.aspx