Questions tagged [asp.net-core]
ASP.NET Core is an open-source, cross-platform framework for building web applications. Use this tag for questions about ASP.NET Core applications. Use a specific version tag when your question is specific to a particular version of ASP.NET Core.
asp.net-core
117
questions
0
votes
0
answers
17
views
ASP.NET Core MVC: How to remove automatic encoding of html tags?
The program gets text with html tags from the SQLite database, then the text is displayed to the user in the browser. The tags are supposed to be automatically converted to html, but instead the tags ...
0
votes
0
answers
10
views
Cannot add Blazor Web Assembly project to ASP.NET Core .NET 6 application
I need to add Blazor Web Assembly project to ASP.NET Core .NET 6 application.
I did as described in this article How to integrate Blazor application
Removed builder.RootComponents.Add("#app"...
0
votes
0
answers
14
views
Azure Web App failing to deploy with Windows Containers
I'm trying to deploy a windows container that holds a simple ASP.NET Core Web App to an azure web app. I've created a container registry, and pushed my docker image to it. However, every time I try to ...
0
votes
0
answers
8
views
Serilog UI Authentication error while requesting /api/logs
I'm using Serilog UI as a part of my web app to allow users to check logs.
It's a docker containerized project which works fine in development environment (outside docker and on my dev machine) but ...
0
votes
1
answer
31
views
How can I write out the contents of objects to a text file?
I am trying to write out some objects in my .net core 2.1 web app into a readable format to a file.
I have these 3 objects:
var username = saml2AuthnResponse.ClaimsIdentity.Claims.ToList();
var ...
0
votes
1
answer
14
views
How to Reference a User Entity from Another Microservice in ASP.NET Core?
In my microservices architecture using ASP.NET Core, I have two distinct microservices: Identity.API for user management and PersonalAccount.API for handling personal account-related functionalities. ...
1
vote
0
answers
13
views
Model Parameter is Null in POST Method on Azure VM but Works Locally
I have an ASP.NET Core application that works correctly on my local machine but encounters an issue when deployed to an Azure Windows VM. Specifically, the model passed as a parameter to the POST ...
1
vote
1
answer
15
views
How to read the SAML response returned by IdP
I am trying to figure out how to get an email from the saml2AuthnResponse that is returned by the IdP.
I am not sure how to access this using ITFoxTec.
Here is my AssertionConsumerService code:
[Route(...
0
votes
1
answer
25
views
dropdown MVC don't keep focus for selected option
I have asp net core mvc application. After clicking filter controller recives propper data, but drop down always shows All option:
@{
ViewData["Title"] = "Index";
IsOpenFilterState ...
0
votes
1
answer
18
views
Asp.net core razor pages BindProperty collections List not Working
My plan is that I fill a list of data in OnGet and after sending it to the html page, I checkMark some lines and Fill some input on table, and finally it is posted to the server. But in OnPost, the ...
0
votes
1
answer
38
views
In web applications how to hide the sensitive data from software developers [closed]
We are developing an ASP.NET Core application using the MVC framework and SQL Server database. The application is intended for board members, and it's crucial that sensitive data remains inaccessible ...
0
votes
0
answers
32
views
Why does a SignalR connection not exist after starting the client?
I have a couple of clients that intermittently get the following exception:
Connection 'xxx' does not exist.
System.IO.IOException: Connection 'xxx' does not exist.
at Microsoft.AspNetCore.SignalR....
2
votes
0
answers
40
views
How to perform integration test on ASP.NET Core API controller endpoint that requires authentication and validation of antiforgery tokens
Description
I have an ASP.NET Core API controller endpoint that requires:
an authenticated user, and
validation of antiforgery tokens
I want to perform an integration test on this endpoint.
Problem
...
0
votes
1
answer
19
views
How do we use a value from a strongly typed configuration options class and have other services use it - for example AllowedHosts?
I have a strongly typed POCO class that is bound to Configuration Settings being retrieved from Azure App Configuration Services.
As an example, the strongly typed class is:
public class ...
0
votes
0
answers
25
views
Handshake Failure in ASP.NET Core Web API on Ubuntu 22.04 LTS
I have an ASP.NET Core Web API that was working perfectly on my Windows machine. I needed to deploy it on an Ubuntu Linux 22.04 LTS server. I followed this guide.
The application runs and can be ...
0
votes
1
answer
21
views
Using Serilog to log at various levels of verbosity across namespaces and classes
I was led to believe that I can set a global minimum level of Information and then in particular namespaces or classes I could bump it up to Debug or even Verbose. This is the code:
using Commons;
...
-1
votes
0
answers
24
views
Setting up a Next.js solution with a Node.js reverse proxy on ASP.NET Core app
We plan to render content with a NextJS with server-side rendering, client-side routing, working, and where the client app and backend are hosted in the same application. The client app is hosted in ...
0
votes
0
answers
14
views
How to resolve 'Application error: An error occurred in the application and your page could not be served' on Heroku?
I created a web app using asp.net core 6 and deployed it using heroku.
My MySQL DB is on aiven.io, and I can connect to it and ran all my migrations from my local to make sure everything is correct. I ...
0
votes
1
answer
73
views
How to loop through Inner list of object
I have a need where I need to loop through sublist of each class.
public Class A
{
public int IdA {get;set;}
public string Name {get;set;}
public List<Class B> Items {get;set;}
}
public Class ...
-1
votes
0
answers
23
views
VS2022 release build - wwwroot folder missing?
create app with template asp.net core web app ( Razor pages )
build in release mode
Does not have wwwroot folder in release directory /bin/release/net8/
Running in VS2022 showing the styling
Deploy it ...
-1
votes
2
answers
60
views
The service collection cannot be modified because it is read-only
I am using ASP.NET Core 8. I'm trying to resolve a dependency at app start up and then use it to manually register a second dependency.
But I am getting this error
The service collection cannot be ...
-1
votes
1
answer
32
views
Efficiently newing up DbContext without dependency injection
I'd like to write a ClaimsPrincipal extension that returns the company associated with a user has the IsLimited flag set.
public static class ClaimsPrincipalExtensions
{
public static bool ...
0
votes
0
answers
25
views
.NET Core ReactJS Deployment in AWS
When I deployed the Angular/React frontend and .NET Core docker backend in AWS EC2 Linux, there is an issue that the frontend can't call the backend using http:localhost:port inside ec2 locally.
Here ...
1
vote
2
answers
25
views
How to mock IConfiguration.GetSection("foo").get<Type>();
I am new to unit testing...
I have a class Settings.cs,
public class Settings
{
public string Format { get; set; }
}
and this is what the appSettings.json contains,
"AppSettings": {
...
1
vote
1
answer
28
views
Blazor .Net Core 8: How to use Server Side Component on the Client side?
I want to use the InteractiveAuto feature of WASM. So I want to create my pages on the client side.
But I also want to access server side components that have access to my SQL database.
It seems ...
-1
votes
0
answers
23
views
How do I get a .NET Core IIS site to select the proper appsettings.json when the environment variable changes?
The problem
IIS, .NET Core, or the site, do not seem to recognize a change to the system environment variable ASPNETCORE_ENVIRONMENT without a hard restart. For example, changing the value of the ...
1
vote
0
answers
20
views
Not Parsing Hindi When Converting HTML to Image in ASP.NET Core Web API
I am generating a card and downloading using api. One can enter a card number and card is generated and downloaded. But the card contains some hindi texts which is not rendering correctly in the ...
0
votes
1
answer
72
views
StringValues.Contains() always returns false
I'm trying to check if an Accept header includes a MIME type like this:
public static bool AcceptsView(this HttpRequest request) => request.Headers.Accept.Contains("text/html");
However ...
0
votes
0
answers
25
views
what layer should mass transit go in n-tier architecutre or clean architecture [closed]
hoping it's a simple question with a clear answer : what layer should mass transit be, one thing to note it's used as background service for now, that could be changed in the future who knows, the app ...
0
votes
0
answers
36
views
ASP.NET CORE Web API does not replace env settings on IIS
I have an API hosted in IIS.
In local testing, with very scenario, it works perfectly. When deployed to IIS, the appsettings.uat1.json did not get loaded and some environment variables are not changed....
0
votes
0
answers
38
views
Issue with authentication in Blazor
I am working with Blazor authentication. I have implemented a way to authenticate a user through an API controller that signs in the user and returns the current state of the user with http requests.
...
0
votes
1
answer
24
views
How to show description in Swagger of an IFormFile
Unfortunately I cannot add any description to Swagger when using an IFormFile:
[Route("service")]
public class WebServiceController : Controller
{
/// <summary>
/// An upload
/...
1
vote
0
answers
32
views
ASP.NET Core Web API : authentication users files
I'm working on an ASP.NET Core 6 Web API project where users upload their own files, and these files are stored in folders corresponding to their IDs (GUIDs) on the same Linux server.
To serve these ...
0
votes
1
answer
24
views
Windows authentication in DevTunnels
I have a blazor server application with windows authentication.
Server configuration:
builder.Services.AddAuthentication(HttpSysDefaults.AuthenticationScheme);
builder.WebHost.UseHttpSys(options =>...
0
votes
0
answers
24
views
In one of the cshtml files,namespaces can not be found
I am using visual studio 2022 .net 6. All the other cshtml files within the same project are not showing any issues. Only in one cshtml file, the namespaces are not able to be found. All the ...
2
votes
1
answer
32
views
How to make .NET 8's minimal identity APIs work with a global Authorization FallbackPolicy?
My API is enforcing a global authorization policy to require authenticated users on all endpoints, unless they explicitly specify another policy or opt out via [AllowAnonymous].
This works fine with ...
1
vote
1
answer
38
views
How to pass a Guid to a property on a Tag Helper in ASP.NET Core
I have a custom TagHelper I need to pass a Guid to, but I get errors when I pass the value.
How can I pass in a Guid?
TagHelper:
[HtmlTargetElement("assets:signin", Attributes = "...
0
votes
2
answers
65
views
Dropdown Menu Goes Beyond Right Side of Screen
I'm trying to create a multi-level dropdown menu using Bootstrap. By default, the dropdowns should align to the right side, but if there's not enough space, they should switch to align to the left.
...
0
votes
0
answers
38
views
Identity Web Application Times Out K8 Cluster
I have the following setup:
6 (tiny) APIs using .NetCore 8
Deployed onto a k8 cluster on Digital Ocean
Use Dapr for messaging between the APIs (this creates a sidecar for each API service)
There is ...
-3
votes
0
answers
60
views
Why is my code not returning any records? Even though there are rows found. (Entity Framework Core)
using Binus.WS.Pattern.Entities;
using Microsoft.EntityFrameworkCore.Metadata;
using SSG5.C1.BSQWebAPI.Model;
using System;
using System.Collections.Generic;
using System.Globalization;
using System....
0
votes
1
answer
30
views
How can I write a HotChocolate middleware that acts after UseFiltering?
I am building a GraphQL interface in an existing dotnet webapi using HotChocolate v13.
I want to write a middleware in a field that has UseFiltering(), which as far as I know is a middleware as well.
...
0
votes
0
answers
23
views
UserManager: GenerateEmailConfirmationTokenAsync() Invalid Token
I have gone through most posts on this topic, none seem to help/work, so resorting to posting my own question...
Scenario: In my ASP.net App I have a setting where I allow the user to enable or ...
0
votes
2
answers
57
views
Double Response Issue with JWT Authentication in ASP.NET Core
I'm facing an issue with my JWT authentication in ASP.NET Core where I'm getting duplicate responses.
Here's the relevant code for the JWT authentication:
public static class JwtAuthExtension
{
...
0
votes
1
answer
53
views
Many-to-many relationship update in EF Core
In my two classes I created a many-to-many relationship:
public class Author
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
[DisplayName(&...
1
vote
1
answer
48
views
Cannot get second and third parameter from MVC View
I have View where I have a button to download the document
@foreach(var document in Model.Documents)
{
<tr data-id="@document.Id" data-file-id="@document.FileId&...
1
vote
2
answers
31
views
ASP.Net Core Redirecting from POST endpoint to Custom URL
I am using a payment service. This service want me to send a callBackUrl while starting payment process. And the service sends a post request to my callBackUrl after 3D security page. And I am ...
0
votes
1
answer
37
views
How to schedule a background service to initiate every deployment without a controller action
I have built out a service to create an erxcel report which uploads to a cloud storage provider. I am creating a scheduled task to occur at midnight every night to run this service. My issue is I ...
0
votes
1
answer
29
views
Cannot get custom authentication scheme name to work with ASP.Net Core
My ultimate goal is to implement multiple authentication schemes in ASP.Net Core, but I cannot even seem to get a single custom scheme to work. I have included excerpts of my code below. You will ...
1
vote
1
answer
29
views
why modelstate.isvalid always false despite the picture property in model getting assigned
I'm working on a razor pages project. I have an employee model which has a picture property of type byte array. Despite picture being assigned byte array when I check modelstate.isvalid, emp.picture ...
0
votes
1
answer
69
views
Is there a way to make a Blazor website fully work offline?
We have a Blazor website made, but the client needs it to work offline.
I need to load all the data necessary when there is internet connection so that i can later use it in the pages. Not just ...