Click here to Skip to main content
15,891,473 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 Title

WebAPI 

8 Aug 2015 by baotdinh
Hi all,i am learning Angularjs . i have a code:controller.js $scope.save = function (position) { $http.post(serviceBase + 'Positions', { model: $scope.position }) .success(function (data) { });$scope.position already returns an...
11 Jul 2021 by Tshumore
I have a .Net 3.1 API that runs in a Docker container. I am able to do POST requests (using Postman) successfully to one of the methods but when I attempt a GET to the method below I get Status Code: 405; Method Not Allowed This is the method...
24 Feb 2021 by TheBigBearNow
Hello all, I have 2 .net core projects that work perfectly with each other when I run them normal, I have an API and a MVC UI. When I run them in docker containers, I go on my API with swagger, I figured out how to connect my postgres db and...
21 Aug 2021 by freedeveloper
Use the logger system as other Microservices in your eco-system
14 Nov 2016 by Vincent Maverick Durano
A quick demo tutorial on how to setup .NET Core on Mac and creating a simple ASP.NET Core app that talks to PostgreSQL database, and running it on Docker.
7 Aug 2017 by Bart-Jan Brouwer
Modern design example for .NET Core MVC with RESTful service
20 May 2020 by raddevus
Post to your Web API via the XmlHttpRequest - learn how to set up headers, data for body, etc.
20 May 2020 by raddevus
A quick article to walk you through building your .NET Web API and posting to it via AJAX (using JSON)
10 Apr 2014 by Florian Trück
Hi, I found a code sample for uploading multiple files to a webapi controller.Now I am not sure how to rename to files created on the server, as the files are named like this:BodyPart_003fa560-908b-4d94-bed0-ac0532a09a66This is how the code sample looks:string root =...
24 Sep 2013 by ashok yede201
Hello,I am using third party Fileupload control to upload file by ajax call in mvc4.It works fine on local, but when I uploads website on IIS 7, it gives error 404 Not found.It searches for http:IpAddress:PortNumber/api/upload which is missing Virtual directory name from ajax call.My...
17 Nov 2016 by Rajivlcr
I'm working on a tracker application with front end Angular JS and using ASP.net Web api for Get/POST requests handling. Getting 404 page not found error while handling requestsWhat I have tried:Faced lot of issues related to CORS and after lot of googling... solved that issue and my app...
17 Nov 2016 by swapnil patil
I think this is server side issue if you are using .net as a back end then you need to add the cors library for that or you can install it using console window of visual studio.
12 Mar 2020 by Eliza Maria
I have an angular project where I implemented a login function in the login.service.ts.My problem is that no matter what I do I can't get rid of the 405 error Method not Allowed for POST.When I check Postman for the API it gives me the same error...
12 Mar 2020 by Viswanatha Swamy
Good morning, Based on the code 405 method not allowed, it looks like you have to enable the verb POST in the configuration of the ASP.Net Web API. Could you please refer the below link for additional details. Also please resue that you have the...
2 Apr 2016 by Nikita!8
I have deployed web api on iis 8 which work perfectly fine when app pool is deafault.When i change app pool from default to custom app pool POST services stop working it gives 500 error ,whereas Get services are working fine. Same web api works perfectly fine with custom app pool on different...
12 Nov 2014 by HemantShrivastava
Hi ,we had an web api 2 service deployed on production server, every thing was working fine and one day we have started getting 500 error from one of the seviceWe looked into the error codes its showing un handel null exception from one method by some lamda expression Steps that we...
12 Nov 2014 by Deepu S Nair
Do you have a StackTrace or any other details regarding this error?A 500 error is fairly generic server-side error that could indicate a variety of things (compilation issues, exceptions etc). You might consider disabling custom errors within your web.config temporarily so that you can...
19 Aug 2015 by Daksh7
How Do I Do Validation For Date [Required(ErrorMessage = "Select Date Of Birth")][RegularExpression(@"^([1|2]{1}[0|9]{1}[0-9]{1}[0-9]{1})[\-](0?[1-9]|1[012])[\-](0?[1-9]|[12][0-9]|3[01])+$ ", ErrorMessage = "Enter YYYY-MM-DD format only")]public Nullable DOB { get;...
19 Aug 2015 by Mayank Vashishtha
Phil.o is absolutely right. You must not go for regex(it's vulnerable). Why don't you go for any custom attribute based validation. Hope this link helpshttps://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.customvalidationattribute%28v=vs.95%29.aspx
19 Aug 2015 by George Swan
I would use the DateTime class to do the validation string requiredFormat = "yyyy-MM-dd"; string dateString = "1999-04-08"; DateTime dateTime; Console.WriteLine( DateTime.TryParseExact(dateString, requiredFormat, null,...
26 Sep 2013 by Rahul Rajat Singh
In this article we will talk about the basics of ASP.NET Web API.
26 Dec 2013 by Rahul Rajat Singh
In this article we will look at the various ways of hosting ASP.NET WebApi.
6 Aug 2018 by prapti.n3
I am executing the following code to get data from Web API: $(window).load(function () { var jsonObject = { "CompanyID": 1, "UserName": '30', "UserPwd": '30', "UserRole": 3, "RemoteHostIP": '8.8.8.8' ...
6 Aug 2018 by Richard Deeming
Your API code is throwing an exception. When that happens, your action returns null rather than an appropriate response message. Change your catch block to return a suitable response message: catch (Exception ex) { CTException.WriteDBLog(strCodeFile, "Login_User", ex.Message,...
25 May 2015 by Dave Kreskowiak
So, what's the question? All you did was copy your assignment into a post. You never bothered to say what part of this you're having a problem with.If you wanted someone to do your homework for you, you've come to the wrong site.
25 May 2015 by Maciej Los
Here is a set articles (links):Say Hello to ASP.NET Web API[^]ASP.NET Web API[^]A Beginner's Tutorial for Understanding and Implementing ASP.NET Web API[^]Read it and try to do something by yourself!
21 Aug 2019 by Member 14359787
Hello my web application is hosted over internet. My web application is in angular 7. For some purpose i developed a web API in Node JS which is hosted on all the client machines who will use the web application. Both the web application and web API are configured on https. If i run my web...
16 Jun 2014 by Manish Kumar Namdev
Hi Friends,I am new to web api. I have created a sample project of WEB API and MVC 4 APP together. Now when I try to make a request as follows I get the error:#jQuery code.function GetAllEmployees() { jQuery.support.cors = true; console.log("Entered to GetAllEmployees"); ...
16 Jun 2014 by Kornfeld Eliyahu Peter
The problem is about same-origin policy[^]. It means that you can not make such call from one domain (localhost:51789) to other domain (localhost:51848).You may set crossDomain to true on $.ajax, but the only certain solution is set Access-Control-Allow-Origin header on your target domain.It...
16 Jun 2014 by Akhil Mittal
Add the below code in your web.config of your API under tag
16 Jun 2014 by wladimirbm
if you want use only jQuery, you can create file.php with curl for you other pathin localhost:51789function GetAllEmployees() { jQuery.support.cors = true; console.log("Entered to GetAllEmployees"); $.ajax({ url: 'http://localhost:51789/EmployeeAPI.php', ...
9 Nov 2016 by Rasmus Lindegaard
I want to make a small web app, in which i need to call on an external WEB API. It exists with Ruby, Python and Javascript bindings, and then theres a JSON version.I was wondering if anyone has tried referencing a Javascript or JSON WEB API this way? I am simply not sure how to create a...
9 Nov 2016 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
Here it is - ASP.Net Core Web API with Visual Studio Code ~ Siderite's Blog[^].
18 May 2020 by Member 12885549
I am implementing queues using https://docs.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-3.1&tabs=visual-studio example. this is how my code looks: in startup.cs I am adding my hosted service and background...
10 Jun 2022 by Jeneesh K. Velayudhan
Hi, I am setting up a project from the scratch. My question is, I'd like to add the react app as a part of the API solution. So that, a full stack developer can work on UI/API at the same time in the single VS instance. The same time, UI...
30 May 2018 by Member 13175079
I was developing a web application which retrieves json data as output and now i want it to be shown in a datatable.When i use newtosoft json its saying ""An exception of type 'Newtonsoft.Json.JsonReaderException' occurred in Newtonsoft.Json.dll but was not handled in user code. I was new in...
30 May 2018 by Jinto Jacob
your code do not have enough data to give a proper solution. but in my opinion your problem is with the DeserializeObject line DataTable myObjectDT = JsonConvert.DeserializeObject(myDynamicJSON); the data you deserializing may not be same as datatable. check if the object type...
30 May 2018 by Patrice T
Quote: Additional text encountered after finished reading JSON content: ; . Path '', line 1, position 46." If you read carefully the error message; it tells you that your json file is not a json file after the position indicated. Only thing to do with your code is to protect it against such...
29 Jun 2018 by 9000605667
after hosting the web apI applcation in godaddy. After browing in the URL i am facing the error What I have tried: Server Error in '/' Application. Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this...
4 Dec 2016 by KyLim0211
$(function () { $('#btnUsingjQuery').click(function () { $.ajax({ url: "http://api.google.com/payment/widget?apikey=xxx&country=RS", dataType: 'json', success: function...
4 Dec 2016 by Afzaal Ahmad Zeeshan
A few things to note here, first of all use the following type for script, But this is not necessary at all now, browsers are smart enough. You can always omit this and it will work. Secondly, jQuery code needs to come inside a handler otherwise $ won't...
4 Oct 2013 by Coldcreek
I was looking for Difference between web API and Web services and WCF.Thanks
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...
23 Mar 2016 by Prince Cheruvathur
This article provides simple steps for creating a template for ASP.Net application using AngularJS, RequireJS and Typescript using AMD module system.
15 Jan 2015 by karthik_r
Hi experts...!Can you please anyone tell me how to slow this issue?An asynchronous module or handler completed while an asynchronous operation was still pending while using await and async.
15 Jan 2015 by Suraj Sahoo | Coding Passion
SO Discussion[^]You will find a very nice answer here on the above link. Please follow I hope this will help you.Thanks
8 Apr 2014 by Florian Trück
I have a webapi project where my android client retreives data. The webapi is secured by BearerToken authentication. The client is aware of that and successfully gets a bearer token.Now my problem is, that on every second request to the same url with the same parameters I get a 401...
10 Apr 2014 by Florian Trück
I found out that DefaultHttpClient not always works as expected. It seems that this one will get deprecated sooner or later.I now use HttpURLConnection for accessing data over HTTP. This works better and also has more options to configure.
2 Feb 2017 by O.Nasri
Great article to learn how you can create web application from scratch using Angular2 & .NET Core Web API
12 Aug 2018 by Sarathlal Saseendran
We will create an Angular 6 application with Cosmos DB and Web API 2.0.
10 Apr 2016 by Shaahinm
I am trying to learn Angular2and I am trying to create a simple blog with authentication.this here is my add a new post method:[Authorize]// POST: api/Postpublic PostModel Post([FromBody]PostViewModel model){ var post = new PostModel { Body =...
15 May 2017 by Member 13158288
Hi, i have two solutions 1. ASP.NET web application(.Net framework)(Web Api) 2. ASP.NET Core application(.Net Core) in Visula Studio 17. import { Injectable } from '@angular/core'; import { Http, Response, Headers, RequestOptions, RequestMethod } from '@angular/http'; import...
19 Feb 2016 by mbruchet
How to make a multipleplateforme compatible mobile user interface with AngularJS // BootStrap / typescript / TypeLite / Font awesone.
27 Mar 2014 by Vikram Goswami
Hello All,I am working on to create a angularjs application which is mainly handled real time transaction from diffrent vendors.Actually our Payment transaction application is already made in asp.net and running and now for keeping fast performance in the mind we are converting this...
1 Oct 2015 by musti_276
Hi,The question I asked in the google forumhttps://groups.google.com/d/msg/angular/x-9erGOfVak/60FSrTxvAAAJ
1 Feb 2019 by WasiUllah Khan
Created an API for my DropBox file uploader using Flask
24 Jan 2019 by vaibhav1800
Hi All, I am looking ahead to develop a WEBAPI EndPoint which accepts an Image, Resize it and return it back. Please find the minute details below. API Request Parameters a)A Design ID of the Image, b)Image Type c)@ItemType parameter (Need to actually use it in a function called...
1 Oct 2019 by Vincent Maverick Durano
A simple yet organized project template for building ASP.NET Core APIs in .NET Core 3.x
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.
14 Jan 2014 by Lopezd
I have created a WebApi that returns data has json and my controller uses ApiController, which is indicated to return data, has it says in this stackoverflow answer.My situation is that i have to return a View that obtains the data provided by that controller. - Can i in the same...
14 Jan 2014 by Bala Selvanayagam
Web API returns JSON data by default and your presentation layer could be web / winforms (not very much recommended)- Can i in the same controller return the data and the view or do i have to create another controller? The same controller can be used for both web & winforms(winforms is...
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...
28 Jun 2016 by ravithejag
In my Project,we are handling WEB API exceptions in Global.asax file (redirecting to Error page if any error occurs).Its working fine when i run in local.Its not working if i deploy the code in the server.protected void Application_Error(object sender, EventArgs e) { ...
18 Feb 2021 by LeMagnifik
I'm on a project in which I get stuck just on the final step. let me explain: my project to filter data and move the filtered data to another spreadsheet (by the way if you see this Marios thanks a lot for your help). all work properly without...
1 Jul 2015 by fenilsuthar
I want to get tweets list from #tag using any API in Asp.net 4.0 C#. I have tried using bellow code. I am getting 401 unauthorized error in GetResponse().My Code :string url = "https://api.twitter.com/1.1/search/tweets.json?q=#Haylof";string oauthconsumerkey = "consumer key";string...
7 Jul 2015 by fenilsuthar
Please see bellow links to search tweets using #Tag in .net 4.0 C#.1. To Authenticate & Get Access Token2. Search First 15 Tweets Using #Tag
21 Jan 2016 by Girish J Jain
This post shows how to use tracing framework with new ASP.NET 5 projects and how logging works in ASP.NET 5 along with certain pitfall that you need to be aware of in the process of using trace listeners. It also shows approach for how to filter log messages with trace listeners.
8 Jun 2016 by Vincent Maverick Durano
ASP.NET 5: Jump Start to AngularJS with MVC 6 Web API
16 Nov 2018 by Vincent Maverick Durano
A quick tutorial on how to integrate VMD.RESTApiResponseWrapper.Core library into your ASP.NET Core 2.1 REST API application
6 Oct 2018 by Vincent Maverick Durano
A step-by-step demo on how to build and dockerize ASP.NET Core and Blazor apps on MacOS
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.
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.
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
16 Nov 2016 by syed shanu
In this article, we will see in detail how to create ASP.NET Core with Repository pattern in the WEB API.
5 Aug 2016 by Vincent Maverick Durano
This series of article will walk you through on building a simple Online Poll System with real-time updates using SignalR 2, jQuery, Core EF, Core MVC and Web API 2.We will take a look at how each of the technologies will be used within ASP.NET Core 1.0.
21 Nov 2016 by Kornfeld Eliyahu Peter
How to host a cross-platform ASP.NET Core application
13 Jul 2020 by DiponRoy
Deploy Web API and Angular from the same project to the same IIS port
6 Nov 2014 by John Atten
In recent posts, I've covered a lot of ground using ASP.NET Identity 2.0 in the context of an MVC application. Since it's RTM in March of this year, Identity 2.0 has offered a substantial expansion of the Authentication/Authorization . toolset available to MVC applications. Similarly, Identity 2.0
27 Oct 2016 by syed shanu
Tutorial for creating a simple web based Hotel Room Booking System using MVC, AngularJS, and WebAPI
9 Sep 2019 by vladimir husnullin
This article shows how to create a single page web applciation using AngularJS. It will be helpful for people willing to study Angular and MVVM practices.
20 Jul 2017 by Bryian Tan
The author is sharing an article on how to create a help tooltip for a HTML element using Web API, Bootstrap Popover and jQuery UI dialog
28 Feb 2016 by syed shanu
In this article, we will see how to create and manage a User Role based menu using ASP.NET MVC, WEB API and AngularJS.
9 Apr 2015 by Parvathaneni Mamatha
How to use Razor Views as Email Templates and Localize them using sample WebAPI
13 Oct 2012 by emrebeysungu
I developed an Asp.net Wep api and it works fine when i run it from Visual studio.But when i publish it to my hosting ,functions which i send my models dont work.But functions which i directly send string work fine.Just get errors from functions which i send a class that i...
26 Jan 2015 by John Atten
Building up a lean, minimal Web Api application from scratch is a terrific way to become more familiar with how things work under the hood in a Web Api (or any other ASP.NET) project.
18 May 2016 by ravithejag
I am trying to handle all HTTP errors to my custom error pages, but I find that when there is a
18 May 2016 by Richard Deeming
Probably because there isn't a solution. Those requests are blocked at the kernel level, before the request even reaches IIS:Properly handle IIS request with percent sign in url (/%)[^]How IIS blocks characters in URLs[^]Use of special characters like '%' '.' and ':' in an IIS...
21 Aug 2013 by karlodegrano
A generic HttpContent Reader that can be used to replace FromBody parameter on Http Action
16 Jul 2013 by Aleksandar.S
Hello everyone,I'm trying to make an IP camera proxy/relay. To clear what that is, a camera can hold up only up to 15 connections. Since this should be used with a larger number of users, my idea is to make a REST web service with Web API and serve an MJPEG stream to every user. The source...
17 May 2016 by Kunwar Bahadur Singh
Below could be one of the possible solution[Route("api/YOURCONTROLLER/{paramOne}/{paramTwo}")] public string PostSetting(int paramOne, int paramTwo) { }The {} names need to match your parameters.
17 May 2016 by zhshqzyc
How can I send two parameters in asp.net web api HttpPost? Assume that I don't want to change MapRoute.What I have tried:// POST: api/Settings/163/20 [HttpPost] public bool PostSetting([FromRoute] int facilityId,int bandwidthRequest) { if...
16 Feb 2015 by John Atten
Identity is fully compatible with the OWIN Authorization model, and when used in this manner, represents a very useful, ready-to go concrete implementation.
23 Mar 2015 by John Atten
This is the third post in a series in which we have built up a minimal, self-hosted, OWIN-based Web Api application essentially from scratch. In this post we'll pull in a minimal ASP.NET Identity implementation.
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
26 May 2022 by Richard-Dev
Hi All, We have a problem with our Web API. When we try to run locally the Web API it is working but when we deploy it on the server it will throw an exception message which is Object reference not set to an instance of an object This is the...
26 May 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...
5 Oct 2014 by JoaoSousa23
This article walks you through configuration Redis and made basic operations using .net C# client.Redis is one of the fastest and feature-rich key-value stores to come from the NoSQL movement. It is similar to memcached but the dataset is not volatile, and values can either be strings lists, sets, s
21 Mar 2015 by Member 11188014
I need some help cause I'm looking for an easy html file using AngularJS so I can do different WebApi calls and see results, statuscode, and time of start-end... but I can't find any good and easy sample over Internet, just some using WepApi2 or Jquery... It will fantastic if someone knows...
5 Jun 2017 by Alexander Kozlovskiy
Used for binding custom types (including files) when sending and receiving multipart encoded form data