0

Here is my wcf restful services created by me.

    [OperationContract]
    [WebInvoke(  Method="GET",    
        ResponseFormat = WebMessageFormat.Json,
        RequestFormat = WebMessageFormat.Json,
        BodyStyle = WebMessageBodyStyle.Wrapped, 
        UriTemplate = "GiveMenu")]

    Stream GiveMenu();

    [OperationContract]
    [WebInvoke(Method = "POST",
        BodyStyle = WebMessageBodyStyle.Wrapped,
        ResponseFormat = WebMessageFormat.Json,
        RequestFormat = WebMessageFormat.Json,
        UriTemplate = "GetOrder/{order_json}")]

     bool GetOrder(string order_json);

Here I can fetch data from GiveMenu method like this :

http://localhost:5203/Service1.svc/GiveMenu

But when i am trying to post data like this :

http://localhost:5203/Service1.svc/GetOrder/{"order":[{"Tb_id":1,"Item_id":1,"Quantity":1,"Add_Details":"null"}]}

Then i said :

HttpException (0x80004005) : A potentially dangerous Request.Path value was detected from the client (:).

Then i did following correction in my web config file :

<httpRuntime targetFramework="4.5" requestPathInvalidCharacters=""/>

Then i showed be Method not allowed like this : Method Not Allowed

What should i do to make data post work and solve this error.

Rocky Balboa
  • 784
  • 10
  • 25
  • possible duplicate of [Getting "A potentially dangerous Request.Path value was detected from the client (&)"](http://stackoverflow.com/questions/6025522/getting-a-potentially-dangerous-request-path-value-was-detected-from-the-client) – Aelphaeis Jul 10 '14 at 16:43

1 Answers1

0

As answered here : Getting "A potentially dangerous Request.Path value was detected from the client (&)"

You could try the following in your web.config file.

<system.web>
    <httpRuntime requestPathInvalidCharacters="" requestValidationMode="2.0" />
    <pages validateRequest="false" />
</system.web>
Community
  • 1
  • 1
Aelphaeis
  • 2,593
  • 3
  • 24
  • 42