I have the same problem as below:
ASP.NET MVC 3 ValidateRequest(false) not working with FormCollection
I have tried to add a reference to the System.Web.Helpers
dll, and added a using System.Web.Helpers
in my controller, but it wont accept Unvalidated()
as a method under Request
. Im using .NET 4 and MVC 3 RC.
In ASP.NET 4.0, request validation becomes extensible. This means that you can extend request validation. Also in ASP.NET 4.0, by default request validation is enabled before the BeginRequest phase of an HTTP request.
To disable request validation in an ASP.NET MVC application, you must change request validation to occur earlier in the sequence of request processing, as explained earlier for ASP.NET Web Forms. In the Web.config file, make the following setting:
The value that you assign to this property is not validated to match a specific version of ASP.NET. Any numeric value smaller than 4.0 (for example, 3.7, 2.9, or 2.0) is interpreted as 2.0. Any number larger than 4.0 is interpreted as 4.0. So defining requestValidationMode="4.5" initially will be interpreted to requestValidationMode="4.0".
The HttpRequest object internally sets a flag that indicates that request validation should be triggered whenever any HTTP request data is accessed. This guarantees that the request validation is triggered before data such as cookies and URLs are accessed during the request.
The Unvalidated()
extension method is defined in the System.Web.WebPages.dll
assembly, not System.Web.Helpers.dll
(but still in the System.Web.Helpers
namespace)
Sorry for the confusion.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With