UrbanPro

Learn .Net Training from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

How do I consume ASP.NET web API services from a Web Forms application?

Asked by Last Modified  

1 Answer

Learn .Net

Follow 2
Answer

Please enter your answer

Trainer

You can consume API using ajax call from your web form, Check below example. $.ajax({ type: "GET", url: "http://www.domain.com/api/yourfunctionName/", contentType: "json", dataType: "json", success: function (data)...
read more
You can consume API using ajax call from your web form, Check below example. $.ajax({ type: "GET", url: "http://www.domain.com/api/yourfunctionName/", contentType: "json", dataType: "json", success: function (data) { //your implementation. }, error: function (xhr) { alert(xhr.responseText); } }); OR you can also use HttpClient for consuming WebAPI, See below code HttpClient client; string url = "http://www.domain.com"; client = new HttpClient(); client.BaseAddress = new Uri(url); client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = client.GetAsync(string.Format("/api/APIFunction")).Result; if (response.IsSuccessStatusCode) { // Modify as per your requirement string responseString = response.Content.ReadAsStringAsync().Result; Deserialize your object } read less
Comments

Related Questions

What is xamarin, how it useful in C# coders?
It is nothing but MONO for Andriod With the support Xamarin we can develop mobile application
Suresh
How to create custom attribute in mvc?
By implementing Attribute class.
JK IT Training
What is .NET?
simple and short definition of .net that .net is a framework
Pavan
How will i get a NET tution?
Hello Ankita, I am .Net Trainer. Having more than 5 Years of Experience. I am Located in Bangalore. I will train for both Theory and Practical with the help of Real time Projects. You can spent few minutes and discuss with me regarding .Net Course.
Ankita
When we use WebAPI controller in Asp.Net MVC
To understand it , First understand the objective of WEB API and MVC WEB API : This technology is designed to develope HTTP Service that would be consumed by many device MVC : This is a framework that...
JK IT Training

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Migration from other languages to Salesforce
Anyone can easily migrate from other language to Salesforce. People must have skills to understand business logic.

A very brief introduction to .NET framework
.NET development has started in the year 2000 , a product of Microsoft. From the begining of .NET development till now, it has got many RAD facilities. Why .NET? developed for distributed computing...

Object Initializers And Collection Initializers: A Syntactic Sugar In C# 3.0
i. Introduction: Object initializers and Collection initializers are part of C# 3.0.These two concepts add a flexibility, readability, and maintainability in C#. As we are C# developers, we should know...

Why a function in C# requires "Return type"??
- Basically , a Method is a piece of code used for the re-usability purpose. - Method is of 2 types Function and Procedure - Function is a method which returns a value to the calling place Function...

Stored procedures advantages
1. Server side secure code 2. Network overhead traffic between server and client through hhtp request and responses minimised. Stored procedures used in ado.net for two main benefits: 1. Network overhead...

Recommended Articles

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Business Process outsourcing (BPO) services can be considered as a kind of outsourcing which involves subletting of specific functions associated with any business to a third party service provider. BPO is usually administered as a cost-saving procedure for functions which an organization needs but does not rely upon to...

Read full article >

Looking for .Net Training ?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for .Net Training Classes?

The best tutors for .Net Training Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn .Net Training with the Best Tutors

The best Tutors for .Net Training Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more