0

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.

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

2 Comments

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.
Oddness- This should work. Are you definitely posting to that action, and not a different one?
2

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

[HttpPost]
[ValidateInput (false)]
public ActionResult DoTheThing (StuffBeingPostedBack stuff)
{
    // ...
}

Comments

1

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.