0

Tried:

[ValidateInput(false)]
    public class MatchesController : ApiController

In web.config I have:

<httpRuntime  requestValidationMode="2.0" targetFramework="4.5.2"/>
<pages validateRequest="false"/>

But still I am getting an error while using put method on address http://localhost:51770/servers/62.210.26.98-1337/matches/2017-01-22T15:17:00Z

Error: a potentially dangerous request.form value was detected from the client (:)

Apparently, it has problem with ":", how can I solve this problem?

Mer_Eng
  • 1
  • 2

1 Answers1

0

If Validate input not works may you try to use AllowHtml attirbute on your model. as referenced here

For ASP.NET MVC 3 applications, when you need to post HTML back to your model, don’t use ValidateInput(false) to turn off Request Validation. Simply add [AllowHtml] to your model property, like so:

public class BlogEntry {
    public int UserId {get;set;}
    [AllowHtml] 
    public string BlogText {get;set;}
 }

UPDATE: For web api request my you try like this:

<system.web>
    <httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" />
    <pages validateRequest="false" />
</system.web>
Community
  • 1
  • 1
nzrytmn
  • 6,193
  • 1
  • 41
  • 38