asp.net-web-api2 Questions

3

Solved

Question How to modify the Status Code text (description/title)? Example For example: I want to change 200 (Ok) to 200 (My Custom Text) Desciption I want to create a HTTP response with custom ...
Nur asked 6/4, 2016 at 21:29

6

I installed Swagger in my ASP.Net MVC Core project and it is documenting my API beautifully. My co-worker asked me to install it in a full framework 4.6.1 project so I've done the following. In P...
Klink asked 14/2, 2017 at 21:36

6

Solved

I'm trying to convert my token string to jwt token using JwtSecurityTokenHandler. But it's getting error that saying IDX12709: CanReadToken() returned false. JWT is not well formed: '[PII is hi...
Deadhead asked 20/2, 2019 at 4:11

12

I am using ASP.NET 5, In my solution I have Web API, Identity Server and Angular 2 project and I am authenticating Angular 2 client by using Identity Server, Angular 2 client consumes web api by pa...

10

Solved

Using Web API and using swashbuckle to generate swagger documentation, I defined two different classes with the same name in two different namespaces. when I open swagger page in my browser it says...
Logistic asked 6/9, 2017 at 9:26

3

Solved

I have three layer application architecture. My Client --> My service A (REST hosted in IIS) --> Other Team's service X (REST). Service A is ASP.Net 4.6.1 framework, not ASP.Net Core. Client is ...
Fortunetelling asked 7/5, 2020 at 15:29

3

Solved

I cannot get a specific header (Content-Disposition) when I'm accessing it via an Angular service. CORS is enabled and the Angular HTTPClient is set to retrieve ALL headers. Startup.cs public v...
Thibodeaux asked 5/12, 2017 at 9:33

7

Solved

Until now, I had a GET method that looked like the following: protected override async Task<IHttpActionResult> GetAll(QueryData query) { // ... Some operations //LINQ Expression based on ...
Marthamarthe asked 14/8, 2015 at 19:51

14

Solved

I upgraded Microsoft.AspNetCore from 2.0.3 to 2.0.5 and my WebAPI project, although running successfully locally, fails to start in production (IIS). Everything was fine in production until this up...

18

Solved

This is probably something very basic, but I am having trouble figuring out where I am going wrong. I am trying to grab a string from the body of a POST, but "jsonString" only shows as null. I al...

2

In my work I was asked to implement health checks into an ASP.NET Web API 2 written in C#. I have searched but all the documentation is for ASP.NET Core and its implementation, does anyone know how...
Keniakenilworth asked 12/6, 2020 at 19:44

4

I am trying to install Swagger API in my ASP.NET WEB API 2 project. I have installed the swashbuckle ( v5.4.0 ) nuget package. I then debug the project and got to URL/swagger/ui/index where I get ...
Realpolitik asked 30/8, 2016 at 6:29

2

Solved

I want to deserialize JToken content to an object (User). How am I able to do this? Here is my json string: string json = @"[{""UserId"":0,""Username"":...
Tice asked 13/2, 2015 at 3:41

3

I have to unit test class that use HttpRequestHeaders as parameter. public HeaderValueProvider(HttpRequestHeaders headers) { _headers = headers; }
Narbada asked 18/2, 2016 at 15:10

4

I'm working with the Microsoft ASP.NET Web API Client Libraries (version 4.0.30506 since I have to run on .NET Framework 4.0) to interface with a .NET web API. I have confirmed that the data is bei...
Peritonitis asked 24/4, 2014 at 21:54

4

Solved

I've upgraded to the latest version of AutoMapper (9.0) and I've changed the static configuration to: public static IMapper RegisterAutoMapper() { var config = new MapperConfiguration(cfg => {...
Paperback asked 16/8, 2019 at 6:19

6

Solved

Yes, I know what you are thinking - yet another CORS question, but this time I'm stumped. So to start off, the actual error message: XMLHttpRequest cannot load http://localhost/Foo.API/token. The ...
Krueger asked 15/3, 2017 at 7:23

5

Solved

I have the following route mapping or WEB API [Route("Foo/Id/{id=1}/bar")] I want to make Id optional as above however from client side no matter what I call it route doesn't match and I get 404...
Loveridge asked 14/3, 2014 at 15:26

6

Solved

My application is setup where all requests except login must be 'authorized' using the authorization attribute in Web API. E.g. [Authorize] [HttpGet, Route("api/account/profile")] public Applic...
Rajput asked 20/2, 2014 at 18:49

3

Solved

I have a request model class that I'm trying to use the default Web API 2 model binding (.NET 4.6.1). Some of the query string parameters match the model properties, but some do not. public async...
Ruthenium asked 28/6, 2018 at 16:2

31

Is there a way to display all enums as their string value in swagger instead of their int value? I want to be able to submit POST actions and put enums according to their string value without hav...
Carbonado asked 6/4, 2016 at 13:22

3

Solved

I understand that RoutePrefix doesn't add a route to the routing table by itself. On your actions you need to have a Route attribute declared. I am having a hard time finding an authoritative blog/...

4

Solved

We have a couple of models that override the name via JsonProperty, but this causes an issue when we get validation errors through ModelState. For example: class MyModel { [JsonProperty("id")] [...
Albertype asked 16/11, 2016 at 19:11

6

Solved

I followed this up to the xml doc part in order to create Swagger documentation using Swashbuckle. It should allow me to view the endpoints via (in my case): http://localhost:51854/swagger/ui/inde...

5

Solved

I searched a lot before putting the questions here but the more I search the more confused I get. So I have created an handler and I am trying to get the route like this: public class ExecutionDe...

© 2022 - 2025 — McMap. All rights reserved.