views:

344

answers:

2
A: 

Ensure that you haven't enabled request validation for this page. I would keep validation running for your site - but turn it off on pages where you need this control.

Be sure to sanitize anything that gets posted and be prudent about security.

rifferte
I definitely have not enabled request validation for the page, although there is a master page
request validation is enabled by default, so you need to turn it off
mgroves
I did turn it off in the page and in the web.config
+1  A: 

The short answer is you shouldn't be getting such an error if you turned off Request Validation.

Did you do one of these two things correctly?

  1. Disable on the page by inserting this at the top of the ASPX

    <%@ Page ValidateRequest="false" %>

  2. Add the below section to your web.config.

<configuration>

<system.web>

<pages validateRequest="false" />

</system.web>

</configuration>

If that doesn't work then check the machine.config and see if the pages validaterequest value is set to true in there as that would override the web.config.

Harv
I did both of these actually
Well, that's interesting, because if you are using webforms putting the web.config value in there should disable request validation across the whole app. Is it possible that the machine.config has an explicit setting for that key with a different value in it? That would override what you have in your web.config.
Harv
no I even added this to the machine.config to be sure