You can read the ref and take a look in the Difference between ApiController and Controller in ASP.NET MVC, since people are commonly confused with them.
Questions tagged [asp.net-apicontroller]
456 questions
-1
votes
1 answer
How can I both dependency injection and send value inside the attribute in .net core?
I want to decrpyt the request and encrypt the result by attribute. For this, I wrote the CheckFilter attribute below. But I need to do dependency injection to use IHashService service in it. I also want to send a value with attribute as it is used…

codinges
- 61
- 6
-1
votes
1 answer
API Controller not being found - ASP.NET
Bit of background:
I'm adding a feature to one of our clunky old systems to keep it ticking over until such time as the new version of the system is at a level where this feature could be brought to a level where it can support this feature.
The…

Andrew Corrigan
- 1,017
- 6
- 23
-1
votes
1 answer
When do I use http attributes in c#
when making a c# controller,
what is the difference between API controller and controller base?
when using HTTP attributes?
My question is that there are controllers that don't use HTTP attributes and everything works fine, I was wondering how…
-1
votes
1 answer
ASP.Net Core WebAPI controller, authorize HTTPClient returning 401 Unauthorized error
I am trying to create a APIcontroller with a HTTPClient that can read from an external API. When I access the API via a link I get the required response however when I try to connect to it from code I get an unauthorised error. I have tried both…

user2140740
- 101
- 2
- 8
-1
votes
1 answer
How to handle long running http requests between Angular and backend API CORE
I am getting timeout issue if my http request is taking long time. The connection of angular and api core is broken, but the api core is running background.
So How can I handle the http request time. Please help.

user3477743
- 1
- 1
-1
votes
2 answers
How to execute a stored procedure returning a pivot table in Web API
How to execute a stored procedure returning a pivot table and return data as JSON in a API. I want to display its data on a web page using API. What I'm getting is just a list of objects but not the data in it.
My procedure is returning 983 records…

Ahmed
- 85
- 3
- 8
-1
votes
1 answer
Searching in ASP.NET CORE API
Can u please help me?
I've project in ASP.NET CORE API where is a database of exams. I need filter it by class. For example: I have a list of exams for whole school and i want to display JSON for only one class exams.
I wrote code from: Microsoft…

Martin
- 33
- 7
-1
votes
1 answer
GET json nested object attribute. [FromQuery]
I'm trying to query for the "UserType" object, and get the attribute "name"
So the whole JSON object is User: and the api call should look like this:
api/user?userTypeName=randomUserTypeName
Where I can search for a specific userTypeName, and return…

Langehk
- 1
- 2
-1
votes
2 answers
How can I correctly implement a .NET controller method that handle POST request retrieving an URI parameter and the request payload?
I have to develop a REST API that have to handle POST request (taking a payload from the body of my request) and at the same time taking an URI parameter.
Into my controller class I have something like this:
public class MailProtocolloController :…

AndreaNobili
- 40,955
- 107
- 324
- 596
-1
votes
1 answer
Split a string into three seperate parts
I have a URL string coming into an API e.g. c1:1=25.
*http://mysite/api/controllername?serial=123&c1:=25*
I want to split it into the channel name (c1), the channel reading number (1) after the colon and the value (25).
There are also occasions,…

The OrangeGoblin
- 764
- 2
- 7
- 27
-1
votes
1 answer
Why are WebApi ApiController objects instantiated for every request?
Our team has discovered, to our surprise, that our ApiController classes are instantiated for every incoming request. Most developers on our team expected that the controller instances would be reused across requests by default.*
We've searched for…

E-Riz
- 31,431
- 9
- 97
- 134
-1
votes
2 answers
How to call a method from API Controller using ajax
I want to call a method from API Controller using AJAX. I have tried the following
I have added one hidden field in the view (like what we are doing in mvc controller)

Averla Team
- 407
- 1
- 6
- 16
-1
votes
1 answer
Angular2 json object with child array returning error
I'm running Angular2 v4.4.0beta. I'm trying to return an object and it's children from my api. The endpoint is called and here is the json:
{
"companyId":3,
"name":"Third",
"description":null,
"characters":[{
…

Alex Boutin Flegel
- 92
- 5
-1
votes
1 answer
unable to use 'swagger.net' in visual studio 2015 while creating .net web api, why?
Unable to use 'swagger.net' in visual studio 2015 while creating .NET web api. Why?
I encountered an error while creating a web api based on .NET. I've installed swagger and related packages.
Error on: SwaggerActionFilter(),…
user8187016
-1
votes
1 answer
Request.GetOwinContext().Get return null in APIControler
I Could not retrieve the data from OwinContext Environment that I store it after authenticate by token.
this is the Code:
[ValidateClientAuthentication]
In thins Code I validate the ClientID of the User and then store the data of ApplicationClient…

Abdu Imam
- 393
- 3
- 16