0

I saw a lot of similar questions here, but no answer worked for me. I have a site (MVC4) with a search function, the search function should accept any character, but only the search form, the rest of the site should work with MVC4 default settings.

I tried the web.config bellow with no success.

<location path="Views/Search">
  <system.web>
    <httpRuntime requestValidationMode="2.0" requestPathInvalidCharacters="" />
    <pages validateRequest="false" />
  </system.web>
</location>

Also my Controller uses the attributes HttpGet and ValidateInput(false)

...
[HttpGet, ValidateInput(false)]
public ActionResult Search(string text)
{
...

What am I missing?

Edit: I'm using Razor 2

maiconmm
  • 311
  • 4
  • 16

1 Answers1

0

Try declaring page with disabling input characters validation for HTML injection:

<%@ Page Language="C#" ValidateRequest="false"%> 
Sasha
  • 8,537
  • 4
  • 49
  • 76