Category "asp.net-web-api"

Passing Odata Query Options in the Request Body

In the Odata 4.01 URL conventions it says that for GET requests with extremely long filter expressions you can append /$query to the resource path of the URL, u

Is there a way to dynamically filter the JSON?

I am searching a way to filter the JObject according to the request from URL. Second code block works as expected and removes the "Id" column from response: My

"WriteLinesToFile" task was not given a value for the required parameter "File"

Error MSB4044 The "WriteLinesToFile" task was not given a value for the required parameter "File". BlazorTutorial.Client C:\Program Files\dotnet\sdk\5.0.

SelectList and DropDownList (razor) in .net web API applications

I am transferring an MVC app to .net core API and was wondering whether it's possible to use SelectList and Html.DropDownList on the razor side in the API app?

Javascript: get a BadRequest error from a Web Api .Net 6 using fetch

I have a little trouble using fetch, This is javascript code: function loginJS() { const login = document.getElementById('login'); const nome = documen

Is there a way to show file uploading progress bar when uploading a file from a blazor WebAssembly (WASM) to a ASP.NET Core server (blazor hosted)

As the title says, I'm looking for a way to inform users about the file upload progress of a file uploaded from the Blazor WebAssembly (WASM) client to the serv

How to modify port in .Net framework web api

I write a demo program, to use .NET Framework Web Api2. For some reason, I have to use .NET Framework rather than .Net Core. But I've got a problem, how to modi

How to Publish dotnet webapi application that have mutiple projects to iis

[![this is my webApi project solution structure.this have multiple projects added][1]][1] how can i publish these kind of projects in visual studio 2019 [1]: ht

[Authorize(Roles="xx") seems no working in asp.net web api

I am working with an ASP.NET web API project (not .NET Core). I want to add [Authorize(Roles="xx") to my controller action. But it seems not working (always 401

Could not load file or assembly 'Microsoft.IdentityModel.Tokens, Version=5.2.0.0

I am trying to add OWIN JWT into webapi project using VS 2015. The reference shows Microsoft.Owin.Security.Jwt, Version=4.0.0.0 and Microsoft.IdentityModel.Toke

EF Core one-one relationships

I need to configure following one-one relationship with ef-core public class Player { public long Id { get; set; } public string Name { get; set; }

How to check if a property is $select-ed?

I am building an OData web API, and I am trying to implement this function to determine whether a given property should be included in a GET response based on t

ASP.NET Core Web API - Cannot instantiate implementation type 'System.Net.Http.IHttpClientFactory' for service type

I am trying to use Dependency Injection to register service in ASP.NET Core-6 Web API. I got this interface: public interface IHttpClientService { Task<T

Issue after deploying ASP.NET Web API to production

I tested ASP.NET Web API in local environment with IIS Express and on other server with full IIS. At both places, token api and post api is working fine. I am u

Fluent Validation to check just ID property

I am using Fluent Validation in my project. I have one validator class. public class CarValidator : AbstractValidator<Car> { public CarValidator()

ASP.NET Core Web API - 'IRuleBuilderInitial<CustomerTransactionRequestDto, decimal>' does not contain a definition for 'CustomCurrency'

Validation is done in ASP.NET Core-6 Web API using Fluent Validation. So, I have this code: Custom Validator: public static IRuleBuilder<T, string> Custom

How to return HttpStatusCode 404 for incorrect url with FallbackPolicy set in AuthorizationOptions?

In the web application I'm currently working on there is a requirement for all users to be authenticated. This is currently handled by using an AuthorizeFilter.

Calling Another Project's Controller From A Project In The Same Solution (.NET Core )

There are 2 projects in the same solution. First project is a .NET Core project and it has all the codes(controllers, models etc.) related to packages. I need t

How to host a web API in a windows service?

I have created and started a windows service (with exe as MyService.exe) using C# on the other hand I follow up this link for self-hosting: https://codeopinion.

How to implement a client_credentials grant type in an angular http request?

I've created an OAUTH2 authorization server which uses client credentials for authentication and is responsible for the issuing of JWT tokens. When I place my