Answered by:
Make POST request

Question
-
Answers
-
Simple GET request
using (var wb = new WebClient()) { var response = wb.DownloadString(url); }
Simple POST request
using (var wb = new WebClient()) { var data = new NameValueCollection(); data["username"] = "myUser"; data["password"] = "myPassword"; var response = wb.UploadValues(url, "POST", data); }
- Marked as answer by Kristin Xie Friday, October 17, 2014 10:03 AM
All replies
-
Simple GET request
using (var wb = new WebClient()) { var response = wb.DownloadString(url); }
Simple POST request
using (var wb = new WebClient()) { var data = new NameValueCollection(); data["username"] = "myUser"; data["password"] = "myPassword"; var response = wb.UploadValues(url, "POST", data); }
- Marked as answer by Kristin Xie Friday, October 17, 2014 10:03 AM
-
Send Object through HTTP POST
By using Ajax call we can send an object.
$.ajax({
type: 'POST',
cache: false,
url: 'http://localhost:54405/api/Bug/InsertData',
data: GetData(),
success: function (model) {
alert("Success");
},
error: function (xhr, status, error) {
alert("Error");
}
});
Where GetData is an object.function GetData() {
var objTask = {
strPrjctID:'146',
blnEmpID:true,
strEmpID:'49'}
}
If we run the above ajax call then request goes to InsertData() method.
-
Check with the link
Mark Answered, if it solves your question and Vote if you found it helpful.
Rohit Arora -
Check this out if you are using Web API.
chanmm
- Proposed as answer by chanmmMVP Friday, October 10, 2014 11:02 AM