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

I'm looking Consultant or MVC Trainer
Hi, I provide .Net MVC training on the latest cutting edge technologies as MVC 5.0, Web API 2.0 and others. Please contact for more information regarding the courses.
Mary
Suggest some good .net mvc training in BTM .
to get basic idea about ASP .NET MVC check out the article http://www.codeproject.com/Articles/866143/Learn-MVC-Project-in-days-Day and go through their video tutorials on youtube.
Pawan
U can host an application in ASP.NET using HTTP and File System, what will be the difference? why HTTP requires? is it mandatory to use IIS for latest ASP.NET applications too?
U can run web app without iss in local. But if you want to access your application out of your system. Require IIS.
Pavan
what is .net?
We have seen BCNF and 3NF. It is always possible to obtain a 3NF design without sacrificing lossless-join or dependency-preservation. If we do not eliminate all transitive dependencies, we may need...
Kodeeswaran

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

Ask a Question

Related Lessons

Benefits of Angular JS over traditional JavaScript and jquery
1. Easy designing web pages 2. Code reusability 3. Client validations more optimized and faster . 4. MVC architecture finds suitable interface to accept server responses Back in more customized manner .

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...

Technology learning Tip
To learn any technology especially related programming you need to think logically and need good practice time. Never try to start from scratch or start reading a book related to to learn a subject. ...

Be FOCUS !!
We must be very focused about learning & Goals. While learning please check your progress and take feedback at various level. Try Again & Again & Again !!! Deepak Garg

Format Date to “MM/dd/yyyy” in Webgrid ASP.Net MVC Razor View
Replace above line with below to apply ("DD/mm/yyyy") formatting to date field in WebGrid AllTicket.Column(columnName: "DueDate", header: "Due Date") grid.Column("Date",format:@<text> @item.Date.ToString("MM/dd/yyyy")</text>)
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