Quantcast
Channel: Web API
Viewing all articles
Browse latest Browse all 4850

Web API & WebForms

$
0
0

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


Viewing all articles
Browse latest Browse all 4850

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>