Questions tagged [asp.net-core]
ASP.NET Core is a lean, composable, and cross-platform framework for building web and cloud applications. It is fully open-source on GitHub. ASP.NET Core apps can be run on Windows, Linux, or macOS.
80,267
questions
0
votes
0
answers
42
views
'no Access-Control-Allow-Origin in the request header
I have created an API with ASP.NET Core, in Program.cs I specified the allowed origins policy as shown:
var origins = 'allowedOrigins';
builder.Services.AddCors((options) => {
options.AddPolicy(...
2
votes
1
answer
40
views
How to delete from multiple tables ASP.NET core?
My code below is only deleting one record with same ID from the second table (OrderDetail). So, I want to rewrite my code in a correct way to delete all records with the same OrderID from second table ...
0
votes
0
answers
28
views
Combining two models in one view ASP.NET Core 6 MVC web app with view model only displays data of one model name
I am working on an ASP.NET Core 6 MVC web application. I have created two models (alongside other models which are irrelevant to my question) and each one has their own properties (not going to ...
0
votes
0
answers
9
views
Is there an ODBC connector for .NET Core that use iODBC when targeting linux instead of unixODBC?
I'm currently building a API in ASP.NET that is supposed to extract large amount of data from HyperFileSQL (PCSOFT). While there is a linux ODBC Driver provided by PCSOFT for their DB system, it's ...
0
votes
0
answers
12
views
Problem to ignore null values and members when use mapster in my blazor project
I have 2 objects. the first one is my dto model and the second one is my real entity.
Of course, my dto model does not have all properties of my entity. So when i use Adapt method to transfer values ...
0
votes
0
answers
10
views
Run Azure pipeline using devops without a PAT from a .net core application
Good day,
Currently I have an c# application running (hosted on azure) that trigger an Azure pipeline with some property's. This solution is currently using a PAT as form of authentication. However we ...
0
votes
0
answers
36
views
How can I use Typeof in a dynamic operation? [duplicate]
enter image description here
I wanted to add the question as "code" instead of uploading an image, but I couldn't pass the rules. The question upload system requires me to write pages of ...
0
votes
0
answers
24
views
Failed to fetch. Possible Reasons: CORS Network Failure with ASP.NET Core WebAPI
I recently deployed an application which was working well on my local machine but when I deployed it to the server and tried to access the endpoints on Swagger, I get the following error response
The ...
0
votes
0
answers
12
views
ASP.NET Core OData response json serialization nullvalue handling
Consider two endpoints exposing data as OData.
The first in an ODataController:
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", &...
0
votes
0
answers
12
views
Blazor Redirect Issue from Login Page to Forget Password Page
I'm encountering an issue in my Blazor application related to navigation. I have a "Forget Password" page with the @attribute [AllowAnonymous] to allow unauthenticated users to reset their ...
1
vote
1
answer
33
views
Docker image mcr.microsoft.com/dotnet/aspnet:8.0 does not build on windows
GIVEN I use Window 11 with Docker Desktop switched to windows container
WHEN I try to build official asp.net core 8 runtime image
docker pull mcr.microsoft.com/dotnet/aspnet:8.0
I get error:
no ...
0
votes
2
answers
29
views
Returning multiple implementations of same interface from Abstract Factory with ASP.NET Core
I want to make multiple implementations of a specific interface accessible through an Abstract Factory in .NET Core. Based on a supplied enum the correct implementation should be returned. This is my ...
0
votes
0
answers
21
views
Using ASP.NET Core 6 having issue to connect to Oracle database using TCPS protocol
After upgraded my application from .NET Framework to ASP.NET Core 6, I am having issues connecting to an Oracle database using TCPS protocol, while existing application is working fine.
I get this ...
0
votes
0
answers
43
views
After upgrade to ASP.NET Core 6, the API is not accepting encoded string with length of more than 512 characters [closed]
We have written an API which accepts encoded text in the request body. We encrypted text using RSAEncryptionPadding.OaepSHA1 algorithm.
We observed the following:
If encrypted text length is 512 ...
1
vote
1
answer
55
views
Minimal API delete with multiple params
It seems that the MapDelete expects a single id to be passed, but my situation, I need to pass a pair of ids. I thought passing a JSON object content would work but it doesn't. Having a POST to act as ...
0
votes
0
answers
24
views
How to get MS Graph API emails to not show up in spam
When I send an email via outlook for my custom domain it goes to the recipients inbox. However, in my c# program when when i use MS Graph API to send an email on behalf of the user it goes into the ...
0
votes
0
answers
21
views
ASP.NET Core 8.0 Identity API endpoints: Why antiforgery is not enabled?
Identity API endpoints are introduced in ASP.NET Core 8.0. I'm trying to use them in my Web API project. It looks like the endpoints do not require antiforgery token validation.
How can I enable ...
0
votes
1
answer
40
views
Blazor (.NET 8) button onclick is not working when the page is in StreamRendering
Good day everyone
I'm trying to use a button click on the weather app, but it seems it's not working when it is set to StreamRendering
But the button onclick is working when I set it to "...
-1
votes
0
answers
19
views
Using Postman, how do I call a .NET AWS SAM Lambda function that's running locally in the Mock Test Tool?
I have a .NET 6 Visual Studio 2022 AWS Serverless application (SAM) running on my local machine via the Mock Lambda Test Tool. I built it using the AWS Toolkit and Powertools for AWS Lambda (.NET). ...
0
votes
0
answers
28
views
Azure Health Check not reading the Health Check from the api
I have setup a health check endpoint on my asp.net core (net 7) web api using the code example below:
services.AddHealthChecks()
.AddSqlServer(connectStrings.Main, name: "Main DB")
....
1
vote
1
answer
36
views
I have to do a personalized validator for my form in ASP.Net core 6 but all the error messages are not loading
This is the courses class, I've added a few validations like: the name of the course must start with KURSE-, the maxlength, comparing the name etc. When i try to add a course with the name "fcdf&...
2
votes
1
answer
37
views
How to add data seed method with IHostedService
This is my Program.cs
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddControllers();
builder.Services.AddTransient<DatabaseSeeder>();
builder.Services.AddScoped<...
0
votes
1
answer
43
views
Passing a parameter using a class to an Html.ActionLink
I want to pass a parameter to an action link using a class.
The action link look like this
@Html.ActionLink(pantalla.Descripcion, pantalla.Action, pantalla.Controlador, pantalla.Parametros)
The class ...
1
vote
1
answer
60
views
ASP.Net Core Identity disable/remove Register and Manage
I created an ASP.Net Core project using Identity and Entity framework core. I only added Login and Logout but for some reason the Account/Register and Account/Manage views and controllers work even ...
0
votes
0
answers
38
views
Unable to read HTTP Statuscode in SOAP call with WCF Client
I'm trying to send a request to a SOAP service using the following code. When something goes wrong on the server we always get the same error. The only thing that's different is the HTTP Statuscode.
...
1
vote
1
answer
28
views
Swagger not loading in ASP.NET Core WebAPI application when using GRPC service
I'm currently working on a project where I have a shared GRPC library containing proto files for both the client and server. The library is then included in a main ASP.NET Core WebAPI project. The ...
1
vote
2
answers
68
views
When i try to update records it will create new record instead of updating
I try to combine both create and edit file in one view and controller. I detect when to edit and when to update by checking id. if id==0 then it will create. But when i updating it will always create ...
0
votes
2
answers
67
views
How to use dependency injection for a ASP.NET Core web application?
I have created an ASP.NET Core web app which has two classes of interest:
public class DBConnect
{
private readonly IConfiguration _configuration;
public DBConnect(IConfiguration config)
...
0
votes
1
answer
37
views
Cache Busting for Static Files in Blazor 8 Across Different Render Modes
I'm working on a Blazor 8 application and I'm having trouble with browser caching of my static files. When I make changes to the CSS files, the changes are not immediately visible because the browser ...
2
votes
1
answer
57
views
.NET 8.0 WebAPI/Swagger Docker Refused to connect
I migrated my application to .NET 8.0, ran it locally and it works perfectly.
Then I created an image, the container. As a result, the page that was working before now returns a "1.2.3.4 refused ...
0
votes
0
answers
33
views
Having additional application claims authenticating a asp.net core with Azure AD B2C
I have an ASP.NET core v7.0 that authenticates to Azure B2C and I'd like to add further application claims in the authenticated principal but so far I was not successful.
My app is basically the ...
1
vote
1
answer
42
views
Blazor specify the Href of a menu item to be a page in another project
I have a Blazor server solution using
Microsoft.AspNetCore.App.Ref v6.0.0 and blazor mudblazor 6.10.0
. The solution has two projects ProjectA and ProjectB, ProjectA has all the Blazor scaffolding ...
0
votes
1
answer
40
views
Navigation did not work on Blazor app in .NET 8.0 when hosting in IIS
I create a Blazor web app using the template from Visual Studio 2022 V17.8.2.
I published it (Web Server IIS - WebDeploy Packages) and imported it in IIS under the "Default Web Site" named ...
0
votes
0
answers
51
views
.Net 6 SignalR - data transfer rate
I try so send 1 gigabyte of data from an ASP.NET Core Web API server (.NET 6 runtime) with SignalR to a client.
The application flow is as follows: Client calls controller endpoint to start a long ...
0
votes
1
answer
57
views
Blazor Server Azure App Service Easy Auth
I have a .Net 6.0 Blazor Server app running in an Azure App Service. Azure gives you the ability to setup your App Service so that it does the authentication for you. This is called Easy Auth. You can ...
0
votes
1
answer
32
views
Minimal API routing issue
I'm creating a minimal Web API.
I have defined two routes:
app.MapGet("/reports/{id:Guid}", GetReportById);
app.MapPost("/reports", CreateReport);
with corresponding delegate ...
-1
votes
0
answers
54
views
ASP.NET MVC Core - Rirect to another controller on button click not working as expected
I have a ASP.NET Core MVC application where Auth0 been integrated.
Following is the requirement:-
1: Use starts the application and Landing page of the application is displayed (http://localhost:43660)...
0
votes
0
answers
68
views
Razor code on asp.net view doesnt apply changes to the website
I am trying to assign an action method to a line in a .cshtml file but despite what I put no changes are reflected on the site.
Here's the razor code:
<div class="container mt-4">
...
0
votes
1
answer
28
views
.NET 8 SDK not installing correctly on Ubuntu 22.04 (WSL)
I've installed the .NET 8 SDK following these instructions: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install
Running these commands:
wget https://dot.net/v1/...
0
votes
0
answers
24
views
Tracking User logins when utilizing basic Microsoft.AspNetCore.Authentication middleware
I would like track user logins of our AspNetCore app that is implementing basic Microsoft.AspNetCore.Authentication middleware. Our membership provider is Azure's B2C product and our app implements ...
0
votes
0
answers
24
views
Index error after adding new lookup/type value
I get an index error on customertype.
I am new to EF so be patient with me.
I have a desktop application in .net core. With a form with fields from customers, one of those fields is a dropdownbox with ...
3
votes
1
answer
72
views
Setting System.Text.Json's PropertyNamingPolicy per web request
I'm upgrading our codebase from Newtonsoft.Json to System.Text.Json. One of the tricky requirements we have is that we need to set the casing in our Web Api to pascal case or camel case based on the ...
0
votes
0
answers
58
views
Blazor .NET 8 - Override RenderMode in child component
Like already asked in this question i also would like to set the rendermode of child components to "StaticServer" so nothing new in addition to the original question, but i want to explain ...
0
votes
1
answer
33
views
How to get the FileList from a file input in a Blazor method
I know how to get this working when using the Blazor <InputFile...> component.
<InputFile accept="image" OnChange="HandleImagePickerResult"></InputFile>
...
...
0
votes
1
answer
63
views
Searching multiple tables and fields in one efficient query
I am trying to build a global search feature for an application that has ~40-50 tables in (and will continue to grow), with each table containing anything from 5-20 fields. I'm struggling to think of ...
0
votes
4
answers
85
views
IOptions<AppSettings> with Base implementation
In my .Net Project I have two projects.
The Infrastrucure project contains a AppSettings.cs with the following structure:
public class AppSettings
{
public string TenantId { get; set; }
}
And an ...
0
votes
0
answers
37
views
Content security policy issue on logout (.NET Core)
I have a security headers middleware in my .NET Core app.
Here is the middleware class:
public sealed class SecurityHeaders
{
private const string CspHeader = "Content-Security-Policy";
...
0
votes
0
answers
36
views
How to make an anthentication flow in ASP.NET Core 8.0 Blazor with external API and jwt token?
By default, Blazor provides a demo app for Identity. What I want is I have an API project that returns jwt token. Now, I want to create a Blazor App using "InteractiveAuto", which means ...
0
votes
0
answers
17
views
How to include startupTimeLimit in publish profile
I don't have web.config in my project and I don't want to include it. So it's generated on publish.
I know I can include environment variables by adding them to the Publish.pubxml:
https://learn....
1
vote
1
answer
79
views
AJAX returns undefined, failure
I am trying to use the success and failure blocks of the AJAX request. My function is working and I can easily direct to the controller and use my queries to modify my SQL database eg. Everything is ...