Category "asp.net-core-webapi"

How to generate oauth_signature in C#

I'm trying to call an API which was associated with OAuth 1.0 version. From the postman wen I tried by passing the header param "Authorization" It's value is as

How could I get a parameter of an action from the ResultExecutingContext when using a Filter

I'm creating a custom result filter that implements IAsyncResultFilter interface. In this filter I need the actual value returned by the Action, but I also need

Hangfire Not Getting Configurations when I try to run Test Case for the method containing hangfire activation .net Core REST Web API

public async Task<IActionResult> SendOrders() { try { RecurringJob.AddOrUpdate("powerfuljob", () => _lab.SendOrders("

implement CRUD functionality with static data using JSON in asp.net core api project

How to do Crud operation on a locally stored json file? For example, I have id, name and roll number. I want to do get, post, put and delete in it using asp.ne

Scaffold-DbContext runs successfully but does not create any models

I am using Visual Studio community edition 2022 and trying to update my Models from database in EntityFrameworkCore 6 (I added new tables and modified some). Wh

Fetching data from an API in ASP.NET Core MVC

I'm facing problem while fetching data from an API in ASP.NET Core MVC controller (imdb api). The problem is I cannot deserialize the current JSON object into t

IFormFile always return null in asp.net core 2.1

Here's how I upload file my Api action : [HttpPost] public async Task<BaseListResponse<MediaStorageModel>> MediaBrand(IFormFile file, int brandId)

Swagger/Swashbuckle Authorize. Scopes checked by default

Is it possible to set an auth scope checkbox checked by default on Swashbuckle UI on a asp.net Core 2.0 Web API?? I use the "openid" scope and I'd like to have

Use Prometheus in .net core application

I am doing POC using Prometheus in .net core app. I did not found sufficient information on Prometheus website to get started , I have following question if som

Specify example requests for swagger's "Try it out"

Is there a way to specify example requests for swagger? Maybe even multiple ones? The Try it out button shows only generic values like: { "firstName": "s

ASP.NET Core 5 returning JSON adding $id and $values properties

I'm using ASP.NET Core 5. As below, I'm using System.Text.Json: public IActionResult Index() { var result = GetAllMenuItems(); return Ok(result); } The

Publishing build artifacts failed with an error: Not found PathtoPublish: D:\a\1\s\$(buildStagingDirectory)

Building CI pipeline for .Net core APIs in VSTS. But while building getting the below error. Publishing build artifacts failed with an error: Not found PathtoP

.net core injecting and resolving services

I am trying my hand at .net core web api. I have created a static method for registering my controllers like this: public static class RegistrationExtensions {

How do I resolve the issue the request matched multiple endpoints in .Net Core Web Api

I notice that there are a bunch of similar questions out there about this topic. I'm getting this error when calling any of the methods below. Microsoft.A

Cannot add [FromHeader] attribute for a model/class in ASP.NET Core 6.0 minimal api

I'm trying to add multiple custom headers in the .NET core minimal API, so I added [FromHeader] attribute in front of input parameters. It's working fine, I can

How to directly set response body to a file stream in ASP.NET Core middleware?

Sample code below to write a file stream to Response.Body in an ASP.NET Core middleware doesn't work (emits empty response): public Task Invoke(HttpContext con

How to cancel .Net Core Web API request using Angular?

I have the following two applications Angular 6/7 App .Net Core Web API I am making GET request to API using Angular's HttpClient as shown below this.subscrip

How to return a specific status code and no contents from Controller?

I want the example controller below to return a status code 418 with no contents. Setting the status code is easy enough but then it seems like there is somethi

Issue with API Versioning .NET Core 2.2 UnsupportedApiVersion

I am creating an API and need to have versioning done in it. I am using package Microsoft.AspNetCore.Mvc.Versioning 3.1.3 My StartUp.cs is as follows In Confi

Visual Studio 2019 Not Showing .NET 6 Framework

I've been struggling to change an asp.net core web api project's target framework to .NET 6 which was started using target framework .net5. I've already tried a