There is a nice & easy article about using Web API in asp.net web forms (here). My project is in asp.net 4.0 web forms and I know I still can use Web API in it. But I am confused because I already am using WebMethods and in the client side programming with jQuery's $.ajax. And that seemed to be doing desired things with"success: <function_name>".'
I understand the advantages of Web API by means of using basic HTTP requests and mapping them to CRUD operations behind the scenes on the server. But my confusion starts when I think from web forms perspective, esp my webforms application, which also happens
to be an intranet application Like I said, at the moment I am following approach and I can achieve desired behavior. The following code perfectly works for me web forms application with WebMethods, how Web API can be beneficial to me?
Clients : If you you ever need to think about clients/browsers, the application only suppoerts IE 9/10/11. ( That's it )
$.ajax({ type: "POST", url: "Views/Bookmarks.aspx/GetBookMarksForCurrentUser", data: encoded, contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { allBookmaks = msg.d; jsonToHtmlTable(allBookmaks); ok = true; }, error: function (msg) { alert("Err : " + msg.responseText); ok = false; } });
Thanks,
-Aarsh