简体   繁体   中英

ASP.NET Multiple values sent using angular $http or $resource

If I submit a form using POST, the ASP.NET server can access each value by name. However, if I do it with javascript like:

$http({
    method: "POST",
    url: TDSV.ROOT_PATH + "/themes/" + data.id,
    params: { "xHttpMethodOverride": "PUT" },
    data: { "newContent": JSON.stringify({ properties: data.json.properties, "otherInfo": "hello world" }, null, "\t") },
    cache: false
});

It is all squashed together into a giant stream that I have to parse through. I have no interest in sending files this way. I just want to separate the strings by name. Is there a way to do this?

It looks like you are using WebForms, if that´s the case you must send the data in a different way.

Here is a tutorial, please take a look and let me know if that helps: http://www.bennadel.com/blog/2615-posting-form-data-with-http-in-angularjs.htm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM