Questions tagged [asp.net-web-api2]

ASP.NET Web API 2 offers an exceptional platform for creating high-quality HTTP services that cater to diverse clients such as web browsers and mobile devices. Leveraging the power of the renowned Microsoft .NET Framework, it undoubtedly emerges as the perfect solution for constructing cutting-edge RESTful services.

Implementing JSON Serializer Settings at a Global Scale in ASP.NET MVC

The navigation properties in Entity Framework are causing an exception of "Circular Object Reference" when the collection in my View Model is being serialized by Kendo Grid. Despite setting "ReferenceLoopHandling" to "Ignore" globally in my Application_Sta ...

The controller did not have any corresponding action to fulfill the request sent from AngularJS connecting to Asp.Net WebApi

My mind is spinning. I am diving into the world of learning AnjularJS with Asp.Net Web Api. The following code snippet features an AnjularJS controller with an ajax call to a Web Api service. CustomerController = function ($http, $scope, $httpParamSeriali ...

Bearer Token CORS preflight request in Web Api 2

I have developed a web application with an AngularJS front-end and a Web Api 2 backend, utilizing bearer tokens for authentication. Everything functions correctly in FireFox and IE, but occasionally in Chrome, the initial login request is pre-flighted. B ...

Troubleshooting CORS problem: Angular 2 and AspNetCore WebApi encounter error with preflight response having invalid HTTP status code 401

Hello there! I am currently working on implementing a straightforward token based authentication method in an Angular 2 RC6 application against an AspNetCore WebApi project that I developed using Visual Studio 2015. If you're interested, I have uploa ...

Enhancing WebAPI service with batch request capabilities

My Batch WebAPI and WebAPI service have been registered in the webapiconfig.cs file with the following code: config.Routes.MapHttpBatchRoute( routeName: "WebApiBatch", routeTemplate: "api/$batch", batchHandl ...

Utilizing an Office App Ajax that includes an authentication header, the application connects to a secure Web API 2 backend with CORS

I am currently in the process of developing a content panel application for Office. As part of this project, I need to authenticate an account against a server. To accomplish this, I have implemented my own AuthorizationFilterAttribute on my web api 2 con ...

Receive JSON data with camel-case in a Web API 2.0 using a model in pascal-case style

My attempt to execute a PUT call on my Web API involves configuring the WebApiConfig.cs file to send data back to my Web project in camel case format. config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesCont ...

(WebApi) Unable to convert a collection of objects to Json serialization

I have encountered an issue with serializing and returning a collection of objects from a WebApi controller. Although it works fine for single object serialization, it fails when the method tries to serialize a collection of these objects. Here is an exam ...

What is the best way to pass multiple row values in a form field using AngularJS to a web API?

Is it possible to insert multiple row values in an AngularJS controller using a web api? <tr ng-repeat="rt in xxtt"> <td> <input type="text" class="form-control" ng-model="rt.name" required /> </td> <td> ...

Guide to utilizing sections within Angular

Planning to develop a website using Asp.net WebAPI and AngularJs. Seeking advice on how to separate the admin area from the user interface of the site. In my previous project, I utilized the MVC area to create an admin section. A friend recommended crea ...

Angular BotDetect encountering CORS issue when connecting to ASP.NET WebApi2 backend

I'm currently utilizing Botdetect in an angular 8 project with an ASPNET WebApi2 Backend. However, I encountered the following error: Access to XMLHttpRequest at 'http://localhost:29739/simple-captcha-endpoint.ashx?get=html&c=yourFirstCap ...

Start with Angular routing, then switch to mvc routing if needed

My project utilizes Angular and node.js on IIS 7.5 for the frontend, and a .NET Web API for backend calls. The Angular routing and API routing are working smoothly when testing with Visual Studio/IIS Express and ng serve. However, they run on separate por ...

What is the best way to handle receiving multipart/form-data in a Web API 2 using the OWIN pipeline?

I am encountering difficulties with properly handling the multipart/form-data post from ng-file-upload in my web api 2 method on the angular UI side. Here is how I am making the call: Upload.upload({ url: config.ApiUrl + 'Orders/CreateOrd ...

"415 (Unsupported Media Type) encountered when making a POST request in a REST API

I've encountered an issue with a React component where a checkbox triggers a POST request to a REST API with a single parameter. Despite setting a breakpoint in the WebAPI code, it's not being hit and I'm receiving a 415 Unsupported Media Ty ...

Relocating the Asp.Net WebAPI to its own domain apart from the Asp.Net MVC site in preparation for the AngularJS

We currently have an Asp.Net MVC 5.0 project that utilizes AngularJS for the front end. The project includes a WebAPI Controller within the same project and is deployed on the same website. This application was created using the Individual User Account pro ...

Building on the foundation of Web API 2.0: Using JavaScriptConverter for Tailored Date Formats

I want to standardize every DateTime object to follow the format "yyyy-MM-dd". Previously, I achieved this by adding the following code snippet to WebApiConfig.cs using JSON.Net: config.Formatters.JsonFormatter.SerializerSettings.Converters.Add( ...

The Angular 2 http request seems to be failing to reach the web api's get method when using a string parameter overload

Issue at hand is that the initial Get method gets triggered by this particular HTTP request: http://localhost:56690/api/testelements/?name=aeg One would anticipate the second (string overload) method to be invoked due to the presence of a string parameter ...

Troubleshooting: Getting 405 or 415 errors when making POST requests from Vue.js to .NET Web API 2

I'm currently struggling with POSTing data to my WEBAPI. Here is the ASP.NET WEBAPI code that I am using: [RoutePrefix("api/Test")] public class TestController : ApiController { // GET: api/Test [Route] public IEnumerable<st ...