9,749 questions
0
votes
0
answers
41
views
NLog.Web.AspNetCore not formatting object as JSON
I'm trying to log error objects as JSON in my ASP.NET Core 9 Web API. I am following the wiki in the NLog documentation: Structured logging.
I have NLog.Web.AspNetCore v6.0.5 as a dependency. In ...
0
votes
0
answers
15
views
Swagger Caching Authentication parameters
I have an ASP.NET Core Web API. I am using Swagger, so when I run my app in debug mode, the Swagger page appears and I can test my endpoints. I also have authentication, and crucially, I'm ...
1
vote
1
answer
51
views
ASP.NET Core 8 IProblemDetailsWriter fails when using [ProducesResponseType(typeof(T), 201)]
I have an ASP.NET Core Web API controller action that returns a 201 Created response with a custom type, and I also have a custom exception handler that writes ProblemDetails for 400–500 errors.
The ...
Best practices
0
votes
4
replies
69
views
Should I create navigation properties for BaseEntity's CreatedBy/ModifiedBy fields in Entity Framework Core?
I'm building an e-commerce application with ASP.NET Core Web API using Entity Framework Core and ASP.NET Core Identity. I have a BaseEntity class that tracks audit information (who created and last ...
-4
votes
0
answers
33
views
After host ASP.NET Core Web API Swagger UI which is not display only 200 showing while I call this in Postman [closed]
I deployed a REST API in IIS, whuch is developed by .net core but I can't access the Swagger UI from the local as well as remote
Also, when I call the API using Postman or cURL, I only get a 200 ...
0
votes
0
answers
49
views
Cannot find how to skip authentication middleware for specifics paths
I am working on a small ASP.NET Core 8 Web API using the Minimal API template.
I'd like to be able to skip my ApiKeyAuthenticationHandler for the health check (/health path) to avoid noise in the log ...
Best practices
0
votes
4
replies
137
views
Upgrading from .NET framework 4.8 VB.NET project to .NET 10
I have an application which was written years ago in VB.NET. Recently I migrated it to .NET framework 4.8. This change was smooth.
Now I am planning to migrate it to an ASP.NET Core 10 Web API using C#...
0
votes
1
answer
67
views
Using LibreOffice portable to convert Excel to PDF in an ASP.NET Core Web API (IIS and IIS Express for development)
I had used LibreOffice portable a while back to convert documents to PDF and I cannot for the life of me figure out how to do it again.
Every time I run this in IIS Express for development I am ...
0
votes
0
answers
43
views
How to add an existing Angular project into the same Git repo as my ASP.NET Core Web API (VS + VS Code setup)?
I am building a full-stack project where:
Backend: ASP.NET Core Web API (created in Visual Studio 2022)
Frontend: Angular project (created separately in VS Code)
Git: I initialized Git from Visual ...
0
votes
1
answer
55
views
How to configure multiple security schemes in ASP.NET Core Swagger with NSwag API spec
I have an ASP.NET Core 8 Web API with a Swagger page using Nswag + OpenAPI3. I also have an OAuth2 security implementation which is working great. Thanks to AspNetCoreOperationSecurityScopeProcessor ...
1
vote
1
answer
94
views
Unable to create a 'DbContext' of type 'AppDbContext'. The exception 'Object reference not set to an instance of an object.' was thrown
I'm getting this error :
Unable to create a 'DbContext' of type 'AppDbContext'. The exception 'Object reference not set to an instance of an object.' was thrown while attempting to create an instance....
3
votes
1
answer
78
views
HttpClient.PostAsJsonAsync (C#) returns 400 - string field is required
I have written an ASP.NET Core Web API method that works fine when testing with Swagger (on localhost in debug mode, while now the API has been published, and my URL is non-local).
The API entry point ...
Best practices
1
vote
1
replies
81
views
Callback in ASP.NET Core with auth cookies
We have a strong use case, and I’d like your suggestion on how to solve an issue we're facing.
We built a banking system using ASP.NET Core that allows users to view their accounts.
Here's how it ...
0
votes
0
answers
69
views
Set HttpContext Response Cookie in Blazor without API
Issue with Auth princliples not being able to write to response in blazor app through an injected service
LoginModal:
@using Microsoft.AspNetCore.Components.Authorization
@using MtgDeckBuilderServices
...
0
votes
1
answer
59
views
"Response Content-Length mismatch: too few bytes written (0 of 152295)" When copying pages from a PDF to another using iText
I'm trying to read a PDF as MemoryStream, and copy pages from that PDF to a new one.
I'm using iText PdfReader and PdfWriter.
var ms = new MemoryStream();
using PdfReader pdfReader = new ...