Questions tagged [webapi2]
127 questions
0
votes
0 answers
how to add success key in web api json array C# web api 2
[Route("api/GetMenuBykidnew")]
[HttpGet]
public IHttpActionResult GetMenuBykidnew(int kid, string Username)
{
ApiBusiness ApiBus = new ApiBusiness();
var result = ApiBus.GetKitchenMenubyKitchennew(kid,…
0
votes
0 answers
Autofac filters for specific 'async' action in a controller not working
I have a Controller with an async Action. I would like to register a ActionFiler (one that implements IAutofacActionFilter, My code is based on Web API 2, using the Autofac Web API intergration module) for that specific 'async' action in that…

Sathya
- 1
0
votes
2 answers
WebAPI .NET - POST request filter by parameters
I use POST to create messages and to update them (I need to use POST, not PUT). The API has the following instructions:
POST /api/message
POST /api/message?update_message
How can I difference between both? Guess I have to do an if in the function: …

Iñigo
- 1,877
- 7
- 25
- 55
0
votes
1 answer
How do I use DI on asp.net web api project not .net core
The following documentation shows how to configure cosmonaut for a .net core project.
https://github.com/Elfocrash/Cosmonaut
Registering the CosmosStores in ServiceCollection for DI support
var cosmosSettings = new…

Luis Valencia
- 32,619
- 93
- 286
- 506
0
votes
0 answers
Angular 7 and D3.js V4 - how to stop rectangle collisions in real time chart?
I am using D3.js V4 library for real-time chart presentation. New dot point is drawing every 2s, and with dot we have the information about weight.
Everything looks fine, but I don't know how to handle rectangle collisions (mark as red).
What is…

Originator
- 37
- 6
0
votes
1 answer
Can we use Odata in Web API? Is it going to live longer
We have a WCF Odata Service enabled. We are planning to migrate to Web API2. I was told we are not going to user Odata.
Could someone enlighten me on, why shouldn't we use Odata. Is it going to obsolete soon. What are the downsides of using it, and…

Surendra Rayapati
- 108
- 1
- 10
0
votes
0 answers
warning: tried to load angular more than once only on webserver
When I follow the direct link /blog/3 on localhost everything works fine.
After publishing to webserver the page constantly reloads and I get 'warning: tried to load angular more than once' in Chrome console.
var app = angular.module("myApp",
[
…

Dazhush
- 1,575
- 1
- 12
- 18
0
votes
1 answer
Model binding fails in webapi 2.0
I am using Webapi 2.0. I am passing one parameter having value as vb/c4t+UuRLnQ2W/g8SQ== After model binding i am getting the value of authId in my code as vb/c4t UuRLnQ2W/g8SQ== The (+) sign gets replaced with a space. Could you please help me out…

thegautamnayak
- 287
- 4
- 15
0
votes
1 answer
C# How to solve HtppWebResponse return Could not establish trust relationship for the [SSL/TLS] secure channel?
I am using .Net Webapi 2 and i am getting the following error during call another web service with 'Https'.
Could not establish trust relationship for the SSL/TLS secure channel
and i also found temporary solution. with adding this line of code…

Wildan Nugraha
- 53
- 9
0
votes
0 answers
how can i configure a message handler based on the environment in webapiconfig.cs file?
I am using Aspnet webapi2. I want to register a message handler based on the environment. can you please let me know how can i configure the same based on environment.
public static class WebApiConfig
{
public static void…

thegautamnayak
- 287
- 4
- 15
0
votes
2 answers
Common ApiController Base Class with Swagger
So i implemented my first REST API application and everything is working fine, including Swagger (I used Swashbuckle and can test my APIs)
In the documentation I read, "...Controller must extend from ApiController...". I get that. However, how…

griftopia
- 135
- 1
- 3
- 10
0
votes
2 answers
Several actions found Web Api
I have web api 2.0 project
When i try to implement several method with same parameter, i have this error : Several actions found
namespace WebApi.Controllers
{
public class EventController : ApiController
{
[HttpGet]
public…

loic ponchon
- 27
- 3
0
votes
1 answer
How to receive a large file(>2GB) in ASP .Net WebAPI with out multipart MIME type?
Is there any way to implement a .net Web api to receive a lrage file(>2gb) using bufferlessinput stream without multipart/form-data mime type?
I am trying to do it with below code, but its not reading the stream completely. I am trying to upload 100…

Thavudu
- 235
- 3
- 13
0
votes
0 answers
WebApi2 default json serializer doesn't throw expected exception
I am sending json like this
{
"NumericField" : "abc"
}
property is declared in object DataRequest like....
[DataMember]
public int NumericField;
Controller recieves data with [FromBody] DataRequest request.
It is quietly setting value to 0.…

MaryFromColorado
- 111
- 2
- 7
0
votes
1 answer
upload media to azure blob storage using asp.net web api 2
I'm developing rest web api that uploads images to my azure blob, I used one of the online tutorial and got this code
public class DocumentsController : ApiController
{
private const string CONTAINER = "documents";
// POST…

ahmed
- 45
- 1
- 10