37,950 questions
3
votes
0
answers
189
views
Hosting .NET 8 Blazor Web App with ASP.NET API
I'm Building a small Website atm. For the Frontend I am using the new .NET 8 Blazor Web App with SSR and for the Backend and .NET 8 ASP.NET API. Is it still possible to host the Blazor Web App with ...
0
votes
2
answers
499
views
Can someone explain to me how model binding in ASP.NET work?
Im trying to do a post request from Reactjs to ASP.NET API, using axios. At first, I got an 400 Bad request error. But after I changed the DTO in the backend, it worked, but the data receive is empty ...
0
votes
0
answers
34
views
How can I receive big nested webhook in C# ASP.NET Web API? I am able to receive small data
I am able to receive small amounts of data, but I'm unable to receive a big chunk of data via webhook in my API. How could I receive big data in my API?
I am able to receive this data:
namespace ...
1
vote
1
answer
132
views
Problems validating JWTs in ASP.NET API running in a container
I'm working on containerizing an ASP.NET Web API. My project is in .NET 8, and the API works fine running both in Visual Studio and Azure. I can launch up the API and call it with JWTs that I obtain ...
0
votes
1
answer
100
views
How does file-based cache in ASP .NET Core Web API work?
For a project I'm working on, I need to retrieve the path of an image from a database. Then use that path to load a locally saved image and load it to convert it to base64. This loading and converting ...
0
votes
1
answer
409
views
How to implement OAuth2.0 DPoP Authentication token in ASP.NET Core Web API?
I want to implement OAuth2.0 DPoP token in ASP.NET Core Web API. I have read the docs and blogs but as a beginner I am unable to get the things. If I get the full demonstration for implementing OAuth2....
0
votes
1
answer
159
views
Unable to set Return values with FakeItEasy
I am just working on testing some Web Api controllers. However, I cannot seem to find what is the problem with being able to set the return values to be a list. When debugging, the output of ClassSql....
0
votes
1
answer
392
views
How to create own ServiceCollectionExtension and pass dependencies as parameters in ASP.net Core c#
I try to create my own ServiceCollectionExtension for the my service 'FdmMediator'.
I want to register the service 'FdmMediator' as a singleton, and I need to pass some parameters. The parameters are ...
0
votes
1
answer
66
views
Trouble saving workout data to database using Entity Framework Core and ASP.NET Web API
I'm encountering difficulties when attempting to save workout data to a database using Entity Framework Core and ASP.NET Web API. I have a Workout class defined with properties such as WorkoutId, ...
-1
votes
3
answers
617
views
Error 401 Unauthorized. ASP.NET Core. Creating authentication/authorization with JWT
So i'm trying to paste JWT after login to SWAGGER, but after trying to enter controller which works only with authorized users i'm getting 401 unauthorized error:
getting token(https://i.sstatic.net/...
1
vote
0
answers
395
views
Angular 17 SSR fetch failed error when making request to locahost ASP.Net Core Web API
This error happen whenever I refresh the page that make this http request.
The user.service.ts that return Observable from the API call.
getUsers() {
let headers = new HttpHeaders();
...
3
votes
1
answer
1k
views
ASP.NET Core Results.File vs Results.Stream
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= ...
0
votes
1
answer
28
views
How is ASP.NET (or any other) Web API server built?
I wonder if there is any scheme, diagram or book that would explain how are Web API servers built?
I am talking about deeper stuff like for example how is threadpool built, routing table and other ...
0
votes
1
answer
66
views
I can't authorize with the token in local storage. Request to the API returns 200, but navigating to [Authorize] pages yields 302
Web API Enpoint
[HttpPost("login")]
public async Task<IActionResult> Login([FromBody] LoginRequestDto loginRequest)
{
var token = await _authService....
0
votes
1
answer
502
views
Returning Entity Results with Includes from Web Api
I'm fairly new to Entity Framework Core.
I have a data structure like this:
Books contain many Chapters.
Chapters contain many PageNotes.
My entity query in my API controller is like this, and through ...
1
vote
0
answers
1k
views
How to create a REST API with .NET Framework?
I created a project in Visual Studio 2022 with the main template "ASP.NET Web Application (.NET Framework)" and sub template "Web API".
This created a project with the ...
1
vote
2
answers
233
views
The 'GetUriByAction' method in the LinkGenerator class in Asp.Net Core is not defined in the Repository layer of the project
The EmployeeLinks class in the Repository layer.
using Contracts;
using Microsoft.AspNetCore.Routing;
using Entities.LinkModels;
using Entities.Models;
using Shared.DataTransferObjects;
using ...
2
votes
1
answer
120
views
Class validation on response body in .NET WebApi
I would like to apply class validation on the response body/output of my .NET WebApi in the same way .NET automatically validates the request body using class validation.
public class ...
0
votes
1
answer
826
views
How to split Serilog log file into multiple files?
I'm trying to split logs by SourceContext.
After spending some days and reading the documentation and many, many, many posts, I have this config and not a solution:
"Serilog": {
"...
0
votes
2
answers
88
views
Web Forms aspx - PostAsync Web API
I have a Web Forms application calling a Web API post action but it is not working.
Calling the Post action from Swagger and Postman is working. So am thinking the issue is not in the Web API.
Have ...
0
votes
1
answer
6k
views
How to produce Antiforgery Token in blazor Server and blazor WebAssembly in .Net 8.0 in an Client Server Architecture
A Coverity scan on our application reported a potential risk from CSRF attacks. In order to prevent this, I tired to implement the Antiforgery token concept in our Blazor webassembly and Blazor ...
0
votes
1
answer
614
views
Application Insights capturing ALL traces while appsettings.json level is set as Inforamtion
I have a very simple Asp .Net API project where I am trying to add some trace logging.
I need some help with Application Insights configuration for that logging.
Right now its capturing ALL traces ...
0
votes
0
answers
96
views
preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource
I have a webapi and webapp running in vs local debug mode and I'm receiving a cors error.
Access to XMLHttpRequest at 'http://localhost:64335/token' from origin 'http://localhost:64333' has been ...
0
votes
1
answer
202
views
How to properly perform a one to many mapping in ASP.NET with Entity Framework in its entirety
Currently I am working with ASP.NET and Entity Framework. I am trying to set up users which will have a one-to-many relationship with notes (one user, many notes).
I believe the fields are correct on ...
2
votes
1
answer
202
views
Types of asynchronous background code execution in REST API endpoint
I am implementing a REST API endpoint in ASP.NET, that should do the following:
Asynchronously start a long-running algorithm
Return 202 Accepted immediately after starting the algorithm (no await)
...