How to receive a POST request

1

I am connecting to an api which asks me as a final step to receive status notification through a POST, that is, the api sends me a request in POST type. I have developed a web servise in .asmx type

[WebService(Namespace = " http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
// [System.Web.Script.Services.ScriptService]
public class confirma : System.Web.Services.WebService
{

    [WebMethod(EnableSession = true)]
    [ScriptMethod(UseHttpGet = true)]
    public void pruebaC(string resp)
    {
        //Mi código que recibe los datos por post
        HttpCookie ConfirmaP = new HttpCookie("PrestezaR");
        ConfirmaP["datos"] = "Resp " + resp;
        ConfirmaP.Expires = DateTime.Now.AddMinutes(10);
        HttpContext.Current.Response.Cookies.Add(ConfirmaP);
    }
}

The documentation of the api tells me that a request type post will be arriving at the route that I send in a parameter 'x'. ( link ) It's my route that I send you and where my services are hosted. Within the test, I try to save the answer but regardless of that I never get there. How can I receive the POST of the api 'x'?.

    
asked by Darian25 29.09.2018 в 02:16
source

1 answer

1

If you are using classic ASP.NEt with WebServices, you should put this in the configuration file

<system.web>
    ...
    <webServices>
        <protocols>
              <add name="HttpPost"/> 
              <!-- <add name="HttpGet"/>  -->
        </protocols>
    </webServices>
    ...
</system.web
    
answered by 02.10.2018 в 20:07