Skip to main content
Filter by
Sorted by
Tagged with
4 votes
1 answer
356 views

So, I got this little minimal api endpoint: app.MapGet("/person/{name}", (string name) => { var person = people.FirstOrDefault(p => p.Name.StartsWith(name)); if (...
cookieMonster's user avatar
0 votes
0 answers
397 views

I setup Minimal API with .NET 8 and enable Swagger and Swagger UI. var builder = WebApplication.CreateBuilder(args); builder.Services.ConfigureHttpJsonOptions(options => { options....
TaskForce20's user avatar
0 votes
1 answer
74 views

So I had this brilliant idea to troll the attacker by setting up a nonsense response to faking a path escape. At one time this used to do something interesting GET /../../etc/passwd HTTP/1.0 So I ...
Joshua's user avatar
  • 43.6k
0 votes
1 answer
116 views

Edit: The problem was that app.UseRouting(); was called before app.Use(async (context, next) => {...}). Once I place everything in this order, it worked: app.Use(async (context, next) { ... }); app....
Tar's user avatar
  • 9,125
1 vote
1 answer
578 views

I have set up a .NET 8 Minimal API with an endpoint that accepts two query parameters, one is an int? and one is a string?. Route.MapGet("/SearchForServiceCompany", (IMapper ...
Jeremy D's user avatar
-1 votes
1 answer
861 views

@azure/msal-browser 3.20.0 @azure/msal-react: 2.0.22 I have SPA react client app, and API on backend. I made two App registrations, exposed custom api, consented as admin. Everything works, i ...
Martin's user avatar
  • 410
0 votes
1 answer
641 views

I'm looking for a way to have multiple routes in my ASP.NET Core which differ by a certain header. I found this question which answers the same question BUT for a controllers-based API: Header based ...
Tomáš Bezouška's user avatar
3 votes
2 answers
675 views

When someone calls my api endpoint (Minimal API), I would like to pull a dictionary from the query string. I have the following query parameter struct for my Minimal API endpoint (simplified for this ...
David Poxon's user avatar
  • 2,543
0 votes
1 answer
251 views

I should read an environment variable that I stored at the Windows operating system level, which contains an authentication token that my middleware class uses to authenticate me with my ASP.NET Core ...
bernox's user avatar
  • 79
2 votes
1 answer
1k views

I'm writing my first application using minimal APIs in a .NET 8 application. I'm following a training exercise I found on Microsoft Learn, and I'm using a database I designed. I ran into this error: ...
Rod's user avatar
  • 4,573
2 votes
1 answer
176 views

If you take a look at this blog post: https://libertus.dev/posts/apsnet-dictionary-model-binder/ I'm trying to achieve exactly the same, just with the minimal api. In the documentation https://learn....
GeorgeR's user avatar
  • 211
0 votes
0 answers
248 views

I use .NET 8 and I have minimal API in ApsNetCore. I have this GET method with param bindings using StronglyTypedId: internal static async Task<Results<Ok<PaginatedList<TestResultDto>&...
toto''s user avatar
  • 1,602
1 vote
1 answer
648 views

I am building a minimal ASP.NET Core Web API. One of my endpoints needs to return data contained in a JObject. This JObject represents a complex nested data structure. What I am finding is that the ...
ki81's user avatar
  • 95
0 votes
1 answer
101 views

I built a Minimal API using EF, Sqlite and C#. It works locally, but once I deploy it to Azure, I get a http 500 status code and a SQLite error that the table doesn't exist. I don't know if it doesn't ...
Manasés Lovera's user avatar
-1 votes
2 answers
1k views

When I publish my ASP.NET Core 8 Minimal API project using these settings: Configuration: Release Target framework: net8.0 Target runtime: Portable on IIS on a Windows Server 2012 R2, I always get ...
Martijn's user avatar
  • 24.9k
1 vote
1 answer
304 views

I am learning Minimal APIs (and also still learning C#), but just got stuck when creating Unit Tests. Given this function: public IResult GetGenderById(Guid id) { var gender = this....
Sir Code-A-Lot's user avatar
1 vote
1 answer
683 views

If I have a string (which is already in JSON format) say string JsonStr = "{ 'A': 123 }"; My API is public JsonResult OnGetRetrieve() { string JsonStr = "{ 'A': 123 }"; ...
s k's user avatar
  • 5,342
2 votes
2 answers
1k views

I have searched on the Internet, and I couldn't find a concrete explanation regarding this. I have used the Minimal API before, and when I am using the .NET AOT, the project source code seems ...
Newbie's user avatar
  • 63
1 vote
1 answer
2k views

I've done a couple of hours of searching after some failed attempts, and I'm hoping someone can provide a little clarity. In the olden days, response.Redirect could be used in a web application to ...
adrianstovall's user avatar
1 vote
1 answer
243 views

I would like to combine a blazor server app with a minimal api as additional option for users to access data. The blazor app uses windows authentication: builder.Services.AddAuthentication(...
RogerB's user avatar
  • 92
0 votes
1 answer
43 views

I have the following setup: var services = builder.Services; services.AddAuthentication(IdentityConstants.BearerScheme) .AddBearerToken(IdentityConstants.BearerScheme); services....
JohnyL's user avatar
  • 7,184
0 votes
1 answer
88 views

I wrote a Minimal Web API with this code: app.MapGet("/api/getLogs", async (HttpContext context) => { context.Response.Headers.ContentType = "application/json"; data =...
Peter's user avatar
  • 2,336
3 votes
2 answers
1k views

in .NET 8, in a project with a minimal API, is it possible to set status codes, for example, 401 Unauthorized, on all endpoints with a single call to a method, for example: app.MapGroup("test&...
pampua84's user avatar
  • 954
1 vote
0 answers
347 views

I am trying to Publish a sample DotNetCore project (from the basic VueJs/Core solution template) to an IIS server with the 'Delete Existing Files' option. If the app has been running, then the Publish ...
WillC's user avatar
  • 2,265
0 votes
1 answer
528 views

I am using currently using AddEndpointFilter for my endpoint using MinimalAPI app.MapGet("/{Id}", Method).AddEndpointFilter<HeaderFilter>() Using NSwag's OperationProcessor, I want to ...
Stagdul's user avatar
  • 78
0 votes
1 answer
269 views

Previously I was working with react projects on .NET 3.1, and I just tried to create a fresh project on .NET 8.0 and encountered a lot of troubles and misunderstandings. I created a new controller and ...
Quribe's user avatar
  • 57
1 vote
3 answers
475 views

Working with .net8.0 Blazor Web App with MinimalAPI and FastEndpoints. Currently, to send an object to a get request that returns a list I'm using var req = new GetAgencyListRequest() ...
FirstByte's user avatar
  • 631
1 vote
2 answers
246 views

My minimal web api use Azure App Configuration to store several configuration settings. Now I need to get some values from that configurations before .Build() the web application and I can't find a ...
invernomuto's user avatar
  • 10.3k
0 votes
2 answers
3k views

I'm trying to implement a single ModelBinder for all my DTOs: public class MyModelBinder : IModelBinder { public Task BindModelAsync(ModelBindingContext bindingContext) { var queryDto = ...
Massimiliano Kraus's user avatar
1 vote
1 answer
530 views

In an ASP.NET Core application, if you use AddMvc() or AddControllers(), you can configure the default behaviour in case the input DTO is invalid, like: services.AddControllers() ....
Massimiliano Kraus's user avatar
1 vote
1 answer
530 views

I wanted to have my API support AOT so I've decided to move away from MVC Controllers. I don't like the minimal API approach though so I've decided to write my own middleware to handle the requests ...
Miroslav's user avatar
  • 4,742
0 votes
1 answer
415 views

With Azure Functions, when I run in the IDE it brings up a console. With a Minimal API project it does not do this, however I can run it with "dotnet watch" from a terminal and see the ...
BVernon's user avatar
  • 3,957
0 votes
2 answers
3k views

I have an ASP.NET Core Minimal API. I want to version an endpoint using request header X-Api-Version. Depending on the version I want to do different things. Something like this: app.MapPost("/...
Endy Tjahjono's user avatar
2 votes
1 answer
1k views

I have a .NET 8 minimal API setup: var builder = WebApplication.CreateBuilder(args); var app = builder.ConfigureApp(); app.Run(); // Reference for Testing Purposes of FastEndpoints namespace BeeHive....
PassionateDeveloper's user avatar
1 vote
1 answer
176 views

I use ASP.NET Core minimal APIs and I try to have my view-models (where incoming client data gets mapped to) use private setters for their properties. But I see that the binding stops working once I ...
user2173353's user avatar
  • 4,770
0 votes
1 answer
1k views

In ASP.NET Core Web API, I may have an endpoint as follows: [HttpPost("doSomething")] public async Task<IActionResult> DoSomething([FromBody] SomeObject request) { // ... } With ...
user4779's user avatar
  • 847
5 votes
1 answer
4k views

I want to map List<T> from query string in .NET 8 Minimal API. Tried like this: public record ColumnFilterDto(string Column, object Value); app.MapGet("/", ( [FromQuery] List&...
adriannowaq's user avatar
3 votes
1 answer
2k views

I want to apply a filter to all asp.net core minimal API endpoints. The reason I want to do this is to post-process the return values of the endpoint. Something like this: public class ...
user2173353's user avatar
  • 4,770
3 votes
1 answer
1k views

I am returning a file from my ASP.NET Core API using this code: app.MapGroup("file").MapGet("/export", async () => { var fileStream = someCode1(); var fileType= ...
Kaloyan Manev's user avatar
2 votes
2 answers
80 views

I'm working on developing an F# wrapper for ASP.NET Core's minimal API to make route handlers more idiomatic to F#. My current implementation for a simple GET endpoint looks traditionally C#-ish: app....
ShNeoteric's user avatar
0 votes
3 answers
2k views

I am trying to to Minimal API in an ASP.NET Core app. I added the following endpoint app.MapPost("api/content", CallbackAsync); The defined the CallbackAsync as a static function as the ...
Jay's user avatar
  • 2,422
1 vote
1 answer
1k views

I'm using an ASP.NET Core Minimal API, the POST operation reads raw data: app.MapPost("/Authenticate", async (HttpRequest Request) => { string rawContent = string.Empty; using (...
jany's user avatar
  • 33
1 vote
0 answers
426 views

I have working code but am hoping there is a better way... Problem: annotate a parameter in a method used in a minimal API in a way that informs OpenAPI (but does not mislead a future developer -- ...
Stand__Sure's user avatar
1 vote
1 answer
2k views

I have this sample of an ASP.NET Core 8 application using ProblemDetails. var builder = WebApplication.CreateBuilder(args); builder.Services.AddProblemDetails(); var app = builder.Build(); app....
Joel's user avatar
  • 9,038
1 vote
1 answer
101 views

There is a need to do multistage authentications. For example, first login as a plain user with scheme1 (longer enough lifespan of cookie) and an additional login as a super user with scheme2 (short ...
user23207089's user avatar
1 vote
1 answer
790 views

I'm using Minimal Apis together with MediatR and I'm having a problem passing parameters via querystring, below the querystring: /api/Relogio?Name=&ProductRef.Code=asdsadsadsadsadasdsasadsa&...
Ricardo's user avatar
  • 709
3 votes
1 answer
3k views

I am currently using .NET8 and Minimal API to handle requests. Everything works perfectly when a request has a header with the value Content-Type: application/json. However, when the 'Content-Type' is ...
MRP's user avatar
  • 659
2 votes
1 answer
1k views

I'm kind of new to AWS, but trying out the lambdas for minimal api aot for .NET 8. Using the ".NET 8(C#/F#/Powershell)" runtime, with the x86_64 architecture. Built the lambda with the "...
Hallisloak's user avatar
3 votes
1 answer
430 views

When using controllers you can use enums in routes but you have to add the following builder.Services.AddControllers(); .AddJsonOptions(options => options.JsonSerializerOptions....
Peter's user avatar
  • 38.9k
7 votes
2 answers
5k views

I am porting an application from Asp.net Controllers to Asp.net Minimal-Apis. The current project is using model-based DataAnnotations. Controllers do model validation out of the box but MinApi does ...
WillC's user avatar
  • 2,265

1
2
3 4 5
8