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

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
What is the difference between asp.net and vb.net?
asp.net is web technology that is used in building web applications and websites. Vb.net is language that is used in writing programs that are utilizing the asp.net framework Asp.net contains...
Aadarsh
what is the diff. b/w applicatoin & system software ?
1) A system software runs the system where an application system runs over the system software. 2) A system software are programs that run & control the hardware units of the system & an application...
Riluck
How to explain a code to replace a word to word in sentence?
Based on language platform we can use string manipulation function Replace. In Case of Oracle Database simple query can be used. No need of writing lengthy coding. For Example, the String is Phaneendra...
Kavya
what is asp .net in future
No future in asp.net, only Future in MVC.Net. Thanks
Ajaz

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

Ask a Question

Related Lessons

Difference between Abstract Class and Interface
This is probably one of the most commonly asked questions in any job interview for .Net. Before we look into the differences between the two lets find out the main features. Abstract Class By definition...

Read CSV data using ODBC Connection
Codes to read the CSV data using ODBC Connection- Input File: File's Encoding format should be ANSI as below class Student{ public string CollegeId { get; set; } public string AdmissionDate...

advantages of stored procedure in ado.net
The benefits of using stored procedures in SQL Server rather than application code stored locally on client computers include. 1. They allow faster execution: overall request-response...

ASP.NET Syllabus
Part 1: Getting Started with ASP.NET Lesson 1: Overview Of Asp.Net Lesson 2: Adding Controls To A Web Page Lesson 3: Web Page Processing Lesson 4: Validating User Input Lesson...

ASP.Net MVC 5 Error: The controller for path '/' was not found or does not implement IController
When a page, that is located inside an area, wants to access a controller that is located outside of this area (such as a shared layout page or a certain page inside a different area), the area of this...
M

Mohammad Shafi

0 0
0

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