TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pushpendra Hirwani
NA
9
1k
Why HttpPost isn't working in WebApi
May 17 2016 5:36 AM
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.
Reply
Answers (
9
)
How to create a web service?
how can get & Post Json formated parameter in .asmx.cs page