Call VB.net webservice from cross domain RRS feed

  • Question

  • User-856070956 posted

    Hi . I have had a vb.net service working for a few years now. Its very simple:

            Public Function ReportComplete(SaltID As String) As String
                Dim db As New AppDataClassesDataContext
                Dim act As Activity = (From ax In db.Activities
                                       Where ax.AlternateID = SaltID
                                       Select ax).First
                Dim am As New AssignmentManager
            Return "OK"
            End Function

    I was making this call from web browser using Jquery:

    function ReportComplete() {
        var Id;
           Id = readCookie("CID");
        /* alert("ID: " + Id); */ 
            type: "POST",
            url: "../../../PlayerComm.asmx/ReportComplete",
            data: "{'SaltID':'" + Id + "'}",
            contentType: "application/json",
            dataType: "json",
            success: function (msg) {
               /* alert(msg.d); */
            error: function (xhr, err) {
                alert("Error occured when reporting complete: " + xhr.responseText);

    This has been working great. But a change is coming. I now have to perform this POST to a different domain, which I understand is prohibited for security reasons.

    I have read about JSONP, but it doesn't allow Posts apparently?

    My head is exploding! Should I be using a different approach? Please help.



    Wednesday, November 2, 2016 6:15 PM

All replies

  • User-691209617 posted

     As per my knowledge JSONP only entertain GET requests but not POST requests. I think if you look around (e.g. Google "JSONP Post") you'll find some workarounds etc but your mileage will probably vary if you choose to use them in any scenario.

    Here is a link for work around.


    Wednesday, November 2, 2016 6:24 PM
  • User-1838255255 posted

    Hi IIIumicode,

    According to your description and sample code, as far as I know, you could use jsonp to realize cross domain call the other webservice, it can realize callback function in server, so that it can call by cross domain in server. About more details, you can refer these links:

    Using JSONP for cross domain requests:


    jQuery’s JSONP Explained with Examples:


    Best regards,

    Eric Du

    Thursday, November 3, 2016 11:57 AM