we’ve created a REST service (which should be called with a PUT request.
We’ve managed to call the service from a HTML page with Jquery (see below), but somehow we can not manage to do it from C#.
The ‘normal’ webrequest just doesn’t seem to work.
Should it be possible to issue a PUT request from a webrequest, and if so, how do we put the PUT data in the request?
The jquery code:
$("#PutUpdatePassword").on("click", function () {
var data = {
userId: "9769595975",
Passold: "qwert1",
Passnew: "qwert2"
};
var json = { 'updatePassword': data };
$.ajax({
type: "PUT",
url: baseUrl + "/profile/190/updateprofile",
contentType: "application/json; charset=utf-8",
dataType: "json",
data: JSON.stringifyWcf(json),
success: function () {
alert("Ok!");
},
error: function () {
alert("Fail!");
}
});
});
1 Answer