Developing ASP.NET MVC Web Applications — Question 174
You are developing an ASP.NET MVC application.
The application must allow users to enter JavaScript in a feedback text box only.
You need to disable request validation.
What should you do?
Answer options
- A. Apply and set the CausesClientSideValidation attribute on the text box to FALSE.
- B. Apply and set the ValidateInput attributeon the text box to FALSE.
- C. Use the HttpRequest.Unvalidated property to read the unvalidated form value.
- D. Use the HttpRequest.Form property to read the unvalidated form value.
Correct answer: C
Explanation
The correct answer is C because the HttpRequest.Unvalidated property allows access to the raw input without triggering request validation. Options A and B involve attributes that do not directly disable request validation for form inputs, and option D does not provide access to unvalidated input specifically.