Tech
Forums
Jobs
Books
Events
Live
Interviews
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
9
Reply
Why HttpPost isn't working in WebApi
Pushpendra Hirwani
May 17 2016 5:36 AM
630
Reply
I am making an ajax request from the clientside to my web service built in web api.
Here is the client side code :
$.ajax({
url: "
http://localhost:1583/api/storage/processing/v1/preview/test.docx
",
type: "POST",
contentType: "application/json; charset=utf-8",
dataType: "json",
cache: false,
responseType: "json",
beforeSend: onProgress,
success: GenerateHtml,
complete: onComplete,
error: onFail
});
Here is the controller's code:
[HttpPost]
[Route(WebApiConfig.RootApiUri + "/v1/preview/{docid}")]
public async Task<List<HtmlViewInformationV1Dto>> Preview(string docid)
{
///...ommitted the code..///
}
HttpPost isn't working, however if change it to HttpGet it works.
Any help on this would be greatly appreciated. Thanks.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
9
)
Next Recommended Forum
How to create a web service?
how can get & Post Json formated parameter in .asmx.cs page