tags:

views:

124

answers:

3

I have ASP.NET MVC application with action which should process posted XML data. At Cassini is working everything fine but when I deploy application to IIS6 I am getting following error.

A potentially dangerous Request.Form value was detected from the client (xml="<?xml version="1.0" ...").

I tried decorate controller with ValidateInput(false) attribute and I also add following method to controller.

protected override void Initialize(RequestContext requestContext)
{
  ValidateRequest = false;
  base.Initialize(requestContext);
}

Nothing help.

Do you have any other idea how can I get rid off this annoying request validation?

Edit: Sorry. I was totally my error as usual. After I setup wildcard mapping everything is working fine.

+2  A: 

Is it (ValidateInput) on a POST method? It only works with POST.

RichardOD
Yes it is a post request that triggers this problem. I also tried to add AcceptVerbs(HttpVerbs.Post) and ValidateInput(false) to particular method but it seems it has now effect at IIS6.
Jakub Šturc
Oddness- This should work. Are you definitely posting to that action, and not a different one?
RichardOD
+2  A: 

As Richard said, you should place it on the action method accepting the input:

[HttpPost]
[ValidateInput (false)]
public ActionResult DoTheThing (StuffBeingPostedBack stuff)
{
    // ...
}
Kieron
+1  A: 

Put [ValidateInput(false)] above your ActionResult in your controller's post methods....

klabranche