exam questions

Exam 70-486 All Questions

View all questions & answers for the 70-486 exam

Exam 70-486 topic 1 question 17 discussion

Actual exam question from Microsoft's 70-486
Question #: 17
Topic #: 1
[All 70-486 Questions]

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?

  • 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.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️
The HttpRequest.Unvalidated property gets the HTTPrequest values without triggering request validation.
Request validation checks for HTML markup and script that might indicate a potential cross-site scripting attack. By default, all values are checked using request validation and if any values contain markup or script, ASP.NET throws an HttpRequestValidationException exception. Use this method if you anticipate that the request will contain markup (for example, you are allowing users to post content that contains markup) and you want to get the raw value of a request.
References:
https://msdn.microsoft.com/en-us/library/system.web.httprequest.unvalidated.aspx

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
rortegax2
4 years, 4 months ago
I think both B and C are valid in practice, since in both cases request validation is disabled, but C is semantically more correct by a subtle difference: with ValidateInputAttribute=false you are disabling Action validation, not Request validation.
upvoted 1 times
...
ticemm
4 years, 6 months ago
The correct answer is C because 'You need to disable request validation in a feedback text box only'. https://docs.microsoft.com/en-us/previous-versions/aspnet/hh882339(v=vs.110)?redirectedfrom=MSDN
upvoted 1 times
...
markcowell
4 years, 7 months ago
Answer is C Request validation checks for HTML markup and script . By default, all values are checked using request validation and if any values contain markup or script, ASP.NET throws an HttpRequestValidationException exception. Use this method if you anticipate that the request will contain markup (for example, you are allowing users to post content that contains markup) and you want to get the raw value of a request.
upvoted 2 times
...
ParkPalaceJoe
4 years, 7 months ago
"disable request validation" not to "disable field validation" so answer is C
upvoted 1 times
...
kar12
4 years, 7 months ago
The correct answer is C: Keypoint is Feedback sent to the server with the request, so the application wants raw data from the user. HttpRequest.Unvalidated enables us to selectively validate the request.
upvoted 2 times
...
Akidoki87
4 years, 8 months ago
I think that the key words here are "disable validation". So you have to disable validation for the textbox and not only read the unvalidated value. I'll go for B
upvoted 1 times
Akidoki87
4 years, 8 months ago
Other sources, however, state that ValidateInput does not exists for Textboxes. So it maybe right to use HttpRequest.Unvalidated as answer suggest.
upvoted 1 times
...
...
theEdgeFL
4 years, 11 months ago
I think the answer is B Why isn't this [ValidateInput(false)] https://dotnettutorials.net/lesson/validateinput-attribute-mvc/ https://docs.microsoft.com/en-us/dotnet/api/system.web.mvc.validateinputattribute?view=aspnet-mvc-5.2
upvoted 2 times
...
apostolin
5 years, 7 months ago
The correct answer is: C.
upvoted 4 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago