0

I'm trying to implement HttpPost method on ASP.NET .asmx. I tried the follwing but it always acting as a httpGet method.

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, UseHttpGet = false)]
[System.Web.Http.HttpPost]
public void token()
{
   //enter code here
}

When I try a POST request on Postman, it return the following error.

System.InvalidOperationException: Request format is invalid: . at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

I have also added the following in the web.config

  <protocols>
    <add name="HttpSoap"/>
    <add name="HttpGet"/>
    <add name="HttpPost"/>
  </protocols>

What other changes do I need to make to make it a HttpPost method?

chamara
  • 12,649
  • 32
  • 134
  • 210

0 Answers0