Click here to Skip to main content
15,885,244 members
Everything / WebAPI

WebAPI

WebAPI

Great Reads

by kusnaditjung
Web specification and framework
by Fred Song (Melbourne)
Build a simple finance application with Angular 13 and .NET 6
by John Atten
When working with ASP.NET Web Api from a .NET client, one of the more confounding things can be handling the case where errors are returned from the Api. Specifically, unwrapping the various types of errors which may be returned from a specific API action method, and translating the error content in
by Vincent Maverick Durano
This article will talk about how to implement a custom wrapper for your ASP.NET Core and Web API applications for managing exceptions, providing meaningful and consistent responses to consumers.

Latest Articles

by Zijian
Use the codes generated by OpenApiClientGen in real world applications
by Zijian
Construct Angular Reactive Forms of client data models through generated Angular TypeScript codes
by Zijian
Construct Angular Reactive Forms of client data models through generated codes
by Zijian
A series of articles comparing programmer experiences of Angular, Aurelia, React, Vue, Xamarin and MAUI

All Articles

Sort by Score

WebAPI 

17 Sep 2020 by kusnaditjung
Web specification and framework
19 May 2022 by Fred Song (Melbourne)
Build a simple finance application with Angular 13 and .NET 6
3 Oct 2014 by John Atten
When working with ASP.NET Web Api from a .NET client, one of the more confounding things can be handling the case where errors are returned from the Api. Specifically, unwrapping the various types of errors which may be returned from a specific API action method, and translating the error content in
4 Jun 2020 by Vincent Maverick Durano
This article will talk about how to implement a custom wrapper for your ASP.NET Core and Web API applications for managing exceptions, providing meaningful and consistent responses to consumers.
7 Jun 2022 by Fred Song (Melbourne)
Build a simple finance application with Angular 13 and .NET 6
21 Nov 2016 by Kornfeld Eliyahu Peter
How to host a cross-platform ASP.NET Core application
25 Dec 2016 by syed shanu
In this article, let’s see how to create our first ASP.NET Core Angular 2 Starter Application (.NET Core) using Template pack using Entity Framework 1.0.1 and Web API to display data from the database to our Angular2 and ASP.NET Core web application.
5 Jul 2016 by Akhil Mittal
This article will focus on practical aspects of formatters and content negotiation in ASP.NET Web API
1 Dec 2019 by Vincent Maverick Durano
The new version of ApiBoilerPlate has recently been released. In this post, we will take a look at the new features added to the template.
20 Aug 2018 by TheQult
Simple middleware to add server side analytics functions to ASP.NET Core
16 Oct 2014 by Gaurav Aroraa
In this step-by-step article, we will discuss all about CRUD (Create Read Update Delete) operations with Web API using Repository pattern.
4 Sep 2017 by Bart-Jan Brouwer
Learn how to create JWT and use with WebApi, REST and MVC All Build with .NET Core
26 Jul 2022 by DiponRoy
Conversion of complex object to a list of objects
4 Sep 2017 by Bart-Jan Brouwer
Learn how to create JWT and use with WebApi, REST and MVC all build with .NET Core
7 Jan 2022 by raddevus
Includes complete C# Web API which allows you to post your app data using simple method
17 Jun 2014 by Terrence Sheflin
I’ve had to build several enterprise size applications over the years, and one of the biggest mistakes I ever made was to re-use the business objects as my data contracts.
27 Oct 2016 by Shashangka Shekhar
In this article, we will focus on how to enable CORS in ASP.NET Core application, get knowledge about CORS policy how we can share resource through different origin.
12 Aug 2018 by Sarathlal Saseendran
We will create an Angular 6 application with Cosmos DB and Web API 2.0.
4 May 2023 by JayWalks
A walkthrough of code solving a real world problem
11 Nov 2015 by Odd Marthon
A versatile visualization web browser application using standard web technologies.
4 Jan 2016 by levelnis
How do you post to a Web API controller from an MVC controller?
29 Nov 2020 by Aram Tchekrekjian
Easily secure ASP.NET Core Web API using API Key Authentication - just follow a few steps and secure your endpoints
4 Oct 2013 by Sampath Lokuge
Web Service1.It is based on SOAP and return data in XML form.2.It support only HTTP protocol.3.It is not open source but can be consumed by any client that understands xml.4.It can be hosted only on IIS.WCF1.It is also based on SOAP and return data in XML form.2.It is...
1 Jun 2015 by Mathi Mani
Authenticate WebAPIs with Basic and Windows authentication
15 Jan 2021 by DotNetLead.com
How to implement paging and sorting to yield good performance
5 Sep 2014 by OriginalGriff
You can't use ":" in the Url - it won't work.Instead, why not your the value that DateTime is based around: the Ticks property? It's an Int64 value so there is no problem in transferring it around, and DateTime has a constructor which works from it directly.
17 Dec 2014 by Mathi Mani
Self Host Web API 2 in ASP.NET web forms application using OWIN
29 Apr 2015 by Mathi Mani
In this article we will learn how to call WebAPI's PUT method with complex input type from C# using model input
24 Dec 2015 by Gaurav Aroraa
Discussing Web API2 Route constraints
10 Jan 2016 by OriginalGriff
Because you are doing something extremely silly.You are trying to present 80,000 rows containing at least 90 columns each of data to your user, and expecting him to find the row he is interested in by scrolling and hoping.Think about it: you you want to revisit a web site if it did that to...
1 Jul 2017 by Milan Stanacev
This article covers internal workings of LiteApi and explains aspects of creating MVC-like WebAPI middleware running on ASP.NET Core .
11 Jan 2017 by Jochen Arndt
0110 is the octal representation for the decimal value 72.With C/C++, octal values are indicated by a leading zero. It seems that the input is parsed by a module build from C/C++ (C# does not support them).The problem should get solved by removing the leading zero:[ { "Cost":...
5 Oct 2017 by Vijay Andugula
Example for database Update and Insert using Angular, Web APIs
15 Oct 2018 by Andy Lanng
The following Json { "success": 1, "login": [ { "username": "123456", "password": "123456", "store_authority": "Yes", "fyear": "2018-19" } ] } Is not an enumerable of "Root Objects. It contains a list but isn't one. The correct way to deserialize it is:...
14 Jul 2019 by Viswanatha Swamy
In this article, we will be looking at how to use SQL Server 2017 Docker image for Local Web API development.
21 Aug 2021 by freedeveloper
Use the logger system as other Microservices in your eco-system
1 Feb 2024 by Zijian
Use the codes generated by OpenApiClientGen in real world applications
28 Oct 2012 by pasztorpisti
HTTP is a simple protocol. You make a tcp connection and send a request then wait for the response. You repeat this over and over. In case of HTTP 1.0 you always make new connections for each request while in HTTP 1.1 you can send and receive multiple requests over the same connection (you can...
12 Nov 2012 by OriginalGriff
Look in the top right of this screen: hover you mouse over your user name.Select the option "My Settings".In the page that comes up, about half way down is "Password" with a clicky beside it labeled "Change..." - I'm sure you know what to do with that! :laugh:Remember to tick the "Remember...
31 Aug 2013 by ridoy
Check these:How to: Call a Web Service[^] Introduction to Web Services in C#[^]Web Services C Sharp .NET End to End Tutorial[^]
22 Jan 2015 by Mohan Gopi
Maybe can be useful to somebody, I found the answer here: You will get the Solution if you refer the the follwing links......
4 Jan 2016 by levelnis
How do you display WebAPI model errors in MVC?
18 Feb 2016 by Dave Kreskowiak
You're asking WAY too much of EF. If this was a requirement (change the DB schema on-the-fly) EF should never have been used.
26 Feb 2016 by Max R McCarty
How are you storing that sensitive application data and should you be?
12 May 2016 by F-ES Sitecore
DateTime can't hold just a time, the clue is in the class name :)Just return the DateTime as it is and your view can convert the value to a string when it shows it, just ignoring the date part and showing only the time.
28 Jun 2016 by Rajendra Kumar Sahu
Fix To Response to preflight request doesn't pass access control check: The 'Access-Control-Allow-Origin' header contains multiple values
30 Aug 2016 by Taiseer Joudeh
This is the third part of the tutorial which will cover Using Azure AD B2C tenant with ASP.NET Web API 2 and various front-end clients. Azure Active Directory B2C Overview and Policies Management – (Part 1) Secure ASP.NET Web API 2 using Azure AD B2C – (Part 2) Integrate Azure Active Dir
13 Sep 2016 by Maciej Los
Start here: c# - Convert JSON to DataTable - Stack Overflow[^] and/or here: Json to DataSet/DataTable[^]Recommended method:DataTable tester = (DataTable) JsonConvert.DeserializeObject(json, (typeof(DataTable)));
5 Oct 2016 by Andy Lanng
You're going to kick yourself when you see it :Pchange id = Convert.ToInt32(_dt.Rows[0]["id"].ToString())to id = Convert.ToInt32(dr["id"].ToString())do that for each item in the linq query
3 Jan 2017 by Fitim Skenderi
Connecting securely to MongoDB by using SSL from GO
18 Jan 2017 by Richard Deeming
Assuming you don't have a firewall between the two computers, just replace "localhost" with the name or IP address of your computer.So instead of: http://localhost:port/api/employeesUse: http://your-pc-name:port/api/employeesIf you have a firewall between the computers, you'll either...
30 Mar 2017 by Afzaal Ahmad Zeeshan
You may use this, RNGCryptoServiceProvider Class (System.Security.Cryptography)[^] and it provides a secure random — not a seeded random number. In most secure cases this is the random number generator that should be used instead of the plain old Random class of the .NET framework. You can read...
18 Apr 2018 by WAMCE
I am working on one MVC application, where there is separate WEB API project also. Now I want to implement update email functionality based on OTP verification from mobile via WEB API. Web API is stateless but still, I want to implement SESSION in my code so that I can access OTP value in...
22 Aug 2018 by Chris A. Johnson
By Chris Johnson @ kolaberate.com Integrating SharePoint with Out Systems Introduction This article is about accessing your Office 365 SharePoint application via the SharePoint API to fetch or update its resources specifically using REST API services from OutSystems.
28 Sep 2018 by Dave Kreskowiak
Your trying to write code at the class level instead of in methods in the class. That's not going to work. In your controller, you're putting the code in the method Index. That's not true in your DAL class.
1 Jun 2019 by Thomas Daniels
If I understand it correctly, your API only accepts the exact string apwerfhafdh>0923817adfhhasfd
19 Sep 2019 by MadMyche
Wants, capabilities, and reality can be vastly different. 1. You want to convert into BMP format and use it on the web. While it is supported by most major browsers, it is one of the least desirable image formats to use on the web as it is big and bulky. It would be much more desirable to use...
18 Oct 2019 by Vincent Maverick Durano
Highlights the detail about what's new in AutoWrapper Version 2. AutoWrapper is a simple, yet customizable global exception handler and response wrapper for ASP.NET Core APIs
15 Jan 2020 by phil.o
You should type "c# get web api data" in your favourite search engine, and follow the links and examples which it will provide to you. This is a quick answers forum, it is not meant to provide full tutorials on such large topics.
13 Jul 2020 by DiponRoy
Deploy Web API and Angular from the same project to the same IIS port
17 Aug 2021 by Richard Deeming
Quote: string[] str = response.RequestMessage.RequestUri.LocalPath.Split('/'); // str contains: { ..., "PDF_Report.aspx" } ... str[str.Length - 1] = str[str.Length - 1].Replace(".aspx", ".pdf"); // str contains: { ..., "PDF_Report.pdf" } var...
7 Feb 2022 by OriginalGriff
This is one of the most common problems we get asked, and it's also the one we are least equipped to answer, but you are most equipped to answer yourself. Let me just explain what the error means: You have tried to use a variable, property, or a...
8 Dec 2023 by Zijian
A series of articles comparing programmer experiences of Angular, Aurelia, React, Vue, Xamarin and MAUI
10 Jan 2024 by Zijian
Construct Angular Reactive Forms of client data models through generated Angular TypeScript codes
9 Jan 2024 by Zijian
Construct Angular Reactive Forms of client data models through generated codes
10 Apr 2024 by Graeme_Grant
Quote: When Manager clicks either of the link, it hits the endpoint and their response is Captured in Database. To prevent sharing, the only option is for the intended recipient to log back in, then you verify both the account used to sign in...
28 Jul 2012 by Christian Graus
There's an object passed in to your event. Check what it is, perhaps you can cast it to work out which button it was ( you should be able to ). Also check the eventargs on the event, if it's not an EventArgs, but a derived class, it's derived to give you the info you want.
18 Oct 2012 by mohsen_alikhani
If you followed this URL : OData support in ASP.NET Web API[]You will see that the MVC 4 Web API version alpha have solution for it but we want supporting it in finalized version !!!
19 Oct 2012 by mohsen_alikhani
The document of the following URL lays out a roadmap for ASP.NET MVC, ASP.NET Web API, and ASP.NET Web Pages : http://aspnetwebstack.codeplex.com/wikipage?title=Roadmap []
31 Oct 2012 by mohsen_alikhani
There is no full support for OData in web app at the moment.
25 Feb 2013 by CodeBlack
Hi,I am currently working on (basically researching) on OData. So I am new to open data protocol. And i want to use this facility with my web api project. As per the requirement i want to fetch the relational data. Basically a data from Parent and Child tables. Everything seems to be...
30 Apr 2013 by Keith Barrow
public string[] Get() { string[] names = new string[3] { "Matt", "Joanne", "Robert" }; using (SpeechSynthesizer ss = new SpeechSynthesizer()) { //ss.Rate = -2; //var word = "Test This Two"; ...
21 Aug 2013 by karlodegrano
A generic HttpContent Reader that can be used to replace FromBody parameter on Http Action
31 Aug 2013 by Gabriel Sas
i have this simple class in an asp.net MVC web api:public class OrdersController : ApiController { // GET api/orders public IEnumerable Get() { return new string[] { "value1", "value2" }; } // POST api/orders ...
2 Jan 2014 by ashuslove
I am trying to pass a Json object from one controller (one) to another controller (two):{ "t": "abc", "r": '0', "o": "", "n": "", "v": "1", "k": "1.0",} in controller two I want to receive that data:[HttpPost]public JObject AllReceivedData(Jobject...
7 Jan 2014 by ashuslove
Finally Got it.//Get Data in Json Formatclient.Headers[HttpRequestHeader.ContentType] = "application/json";//Sent the Request to URL and Fetch the Data in Bytesvar result = client.UploadData("URL", Encoding.UTF8.GetBytes(request));//Convert into dynamic object to get Json...
15 Jan 2014 by rizwan muhammed khan gouri
Helloin edmx table(entitys) and sp have there own cs files.SO when you have sp in edmx and you get it on Model.tt then you used like this:-public IEnumerable GetAllCompanies(){ using (var db = new PTMEntities()){ return db.GetAllCompanies();}...
19 Feb 2014 by Atul Pachori
i have create some wb api i want that when user call my web api he moves to other application get response in api
10 Apr 2014 by Sanket Saxena
Follow:Implementing & Consuming ASP.NET WEB API from JQuery (MVC 4)[^]
7 May 2014 by Andrew Torrance
I think you have a wider problem than the how , and that is I don't think that you can map all possible Json structures to Excel since Json allows for hierarchical data and excel does not . I.e You cant map objects containing other objects and arrays of objects to a grid layout . If your Json...
26 May 2014 by avishekrc
Got the solution:instead of mybytearray= response.Content.ReadAsByteArrayAsync().Result; I am doing:string result=null;result = response.Content.ReadAsStringAsync().Result.Replace("\"", string.Empty); mybytearray=Convert.FromBase64String(result);The key point is:It was...
30 Jun 2014 by Sergey Alexandrovich Kryukov
As Tadit Dash noticed, you show some System.NullReferenceException exceptions in your exception stack. But you don't show the lines in the code where the exception is thrown/propagated.Not to worry. This is one of the very easiest cases to detect and fix. It simply means that some...
8 Jul 2014 by ashuslove
I am using Web Api Service to Pass the Data to my Mobile Devices.There can be 2 scenario for this.1. Single Device Requesting Multiple Times2. Multiple Device Requesting Multiple TimesIn Both the Scenario i am not able to handle multiple Request, I don't know what is the actual...
13 Aug 2014 by Dnyaneshwar@Pune
see thishttp://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-CMS/75/Security/Configuring-Web-Services-authentication/[^]
5 Sep 2014 by Terrence Sheflin
BackgroundI have an MVC Application with a WebAPI component. I'm using jQuery and AJAX to pass and receive data from the WebAPI. I rely on the Application_BeginRequest being fired during each call to perform some mundane task.ProblemApplication_BeginRequest always fires for GET and...
14 May 2015 by Sascha Lefèvre
There are two problems:1: stringdQuery is of type Loan. So you're trying to convert a Loan-object to DateTime. But conversion isn't neccessary in the first place - just access the DateTime-value of stringdQuery.cDate by its .Value-property:dtt = stringdQuery.cDate.Value;2: I don't know...
12 Oct 2015 by Dave Kreskowiak
You can't. The printer settings, as well as all devices on the client side, are inaccessible form client code in the browser.
25 Oct 2015 by OriginalGriff
Don't encrypt passwords!Hash them instead - there is some information on how to do it here: Password Storage: How to do it.[^]
12 Nov 2015 by Gaurav_Chaudhary
Hi,For a Intranet Web App , you can Set a private key in your App config.For every user who first login into your App sends his credential over HTTP and get a unique identifier (Token) which will be used further on every call to HTTP Web API in header. On the Server side, you can decrypt the...
23 Dec 2015 by Mathi Mani
Hi,In order to access a WebAPI using windows authentication, you have to create a HttpClientHandler and set the credentials in it. Then, this HttpClientHandler object has to be passed to the HttpClient.Please refer my technical tip on this for detailed explanation.Authenticate...
14 Feb 2016 by Abhinav S
There is no need for System.web in ASP.Net 5.You need to use .Net core instead.Alternately, switch back to version 4.5.2.References - ScottGu's Blog - Introducing ASP.NET 5[^].Top 10 Changes in ASP.NET 5 and MVC 6 | Stephen Walther[^]
19 Feb 2016 by mbruchet
It is often requested by the customer to import a data file in XML format. It is therefore easier to work in object mode, however, the XML transformation into a pure object might take time to be developed. ExpandoObject provides an answer to this problem ...
4 Mar 2016 by F-ES Sitecore
First of all you need to understand what unit testing is. Unit testing is when you test the logic, you don't use databases, services or anything like that, it only tests the logic. If the project is not written to be unit testable then the chances of it being testable are almost zero and will...
27 Apr 2016 by F-ES Sitecore
If security is a concern then WCF will be your best bet.
30 Apr 2016 by Kornfeld Eliyahu Peter
Use your own IUserTokenProvider[^] implementation to handle those tokens, and create six char long one, when purpose is 'Confirmation'...
30 May 2016 by Afzaal Ahmad Zeeshan
In this article of mine, ASP.NET 5 Web API RESTful CRUDs and Windows 10 native application[^], I have talked about the HTTP verbs, POST and PUT. The problem is not with using which one, the problem is how to use the HTTP verbs in a way that they are meant to be used. Using bad practices, I...
21 Jun 2016 by F-ES Sitecore
You can't stop people amending the url, as said you either need authentication or use ids that you can't guess, like GUIDs rather than sequential numbers, but implementing a log-in is the most secure way.Things you shouldn't spend time doing | The ASP.NET Forums[^]
24 Jun 2016 by OriginalGriff
The second problem is obvious:Operator '==' cannot be applied to operands of type 'bool?' and 'string'else if (loginEmp.Emp_FirstLog == "true")Emp_FirstLog is declared as Nullable, not string.So try:else if (loginEmp.Emp_FirstLog == true)And that error should go away.The...