You need to disable request validation

You are developing an ASP.NET MVC application.
The application must allow users to enter HTML in a feedback text box only.
You need to disable request validation.
What should you do?

You are developing an ASP.NET MVC application.
The application must allow users to enter HTML in a feedback text box only.
You need to disable request validation.
What should you do?

A.
Use the HttpRequest.Form property to read the unvalidated form value.

B.
Apply and set the Validatelnput attribute on the controller action to FALSE.

C.
Use the HttpRequest.Unvalidated property to read the unvalidated form value.

D.
Apply and set the CausesValidation attribute on the controller action to FALSE.

Explanation:
The HttpRequest.Unvalidated Property provides access to HTTP request values without triggering
request validation.



Leave a Reply 7

Your email address will not be published. Required fields are marked *


colins

colins

Correct is B.

colins

scbeast

scbeast

var rawComment = Request.Unvalidated().Form[“comment”]; from https://msdn.microsoft.com/en-us/library/hh882339%28v=vs.110%29.aspx

So Unvalidated is not property. It is a method of Request controller property (HttpRequest is type of this property)

HRVAT

HRVAT

The B you are referring to would have been correct had it been the Attribute was set on the Action method in the Controller rather than the Textbook as mentioned in the option. There is no property named ValidateInput at the textbox.
Answer C is right