All Questions
Tagged with .net-6.0 asp.net-core-6.0
86
questions
0
votes
0
answers
29
views
ASP.NET Core 6 Web API : password popup on new server
We are moving to a new Windows Server 2022 and when using Swagger, some users are experiencing a popup window asking for username and password when trying to run an operation. Others are able to run ...
1
vote
1
answer
37
views
Why does my ASP.NET Core MVC application add some identifier to HTML elements?
When running my new ASP.NET Core MVC application and viewing it in the browser, it seems ASP.NET Core added some kind of ID to some HTML elements.
I'm using .NET 6, and Razor .cshtml pages.
Why? And ...
0
votes
0
answers
54
views
Multiple select dropdown list ASP.NET Core 6
When I create a post, I need a multi-select dropdown field, so I can select more than 1 category for 1 post.
I have created those entities: Post, Category, PostCategory
Do I need this PostCategory ...
4
votes
2
answers
1k
views
Unexpected requirement of "Microsoft.WindowsDesktop.App" in ASP.NET Core app
Recent changes in my Visual Studio solution for an ASP.NET Core (.NET 6.0) API application have resulted in a requirement for "Microsoft.WindowsDesktop.App", with the framework entry being ...
0
votes
1
answer
114
views
How to inject ILogger<Startup> in .NET 6
Recently we moved from .NET 2 to .NET 6. I want to keep using startup.cs file. So I refactored program.cs and startup.cs files as below
Program.cs
Log.Logger = new LoggerConfiguration()
....
1
vote
1
answer
212
views
Require instant MFA for specific Action in ASP.NET Core 6
I'm using ASP.NET Core 6. The app is configured to consume Azure AD authentication with MFA:
builder.Services.AddAuthentication(OpenIdConnectDefaults.AuthenticationScheme)
....
0
votes
1
answer
86
views
Where can I add a logging scope for permission requirements without repeating myself?
In .NET 6, I have added an authorization policy that ensures users have access to a certain set of resources. Now I want to log the ID of the set of resources as well as the User ID to show which user ...
0
votes
1
answer
391
views
Run ASP.NET Core 6 MVC app with attribute route
I have an ASP.NET Core 6 MVC application and when I run my app, I get a http 404 error:
Index action method:
public class HomeController : Controller
{
[HttpGet]
[Route("/User/Dashboard&...
0
votes
1
answer
400
views
.Net Core 6 - IIS worker process crashes and needs IIS app restart
.NET version: .NET Core 6
Server: Windows Server 2019
IIS: 10
I've an ASP.NET Core 6 MVC app which crashes randomly (the application fails to respond) and needs an IIS app restart.
Event viewer error ...
2
votes
1
answer
346
views
ASP.NET Core: get section of appsettings.json as immutable record
Is there a clean way to read in a section of appsettings.json as an immutable record?
For example, if my appsettings.json looks like this:
{
"MySection": {
"Id": 5,
"...
0
votes
0
answers
87
views
Get Product API and Facing this error on swagger, Error: response status is 401
**Requested URL :** https://localhost:7028/api/Products?Authorization=bearer%20eyJhbGciOiJSUzI1NiIsImtpZCI6IjBERTk0RjhGQzBBRkM4RkIxMUYyQzFDMEE4QTRCNzdGIiwidHlwIjoiYXQrand0In0....
2
votes
1
answer
307
views
Is it possible to return a 404 from ASP.NET Core 6 MVC middleware
I have an ASP.NET Core 6 MVC application with both view-based controllers and API controllers. I'd like to be able to disable certain controllers through configuration, and I have a middleware that ...
1
vote
1
answer
857
views
Localization doesn't work in .NET Core 6.0
I try to use ViewLocalizer in my ASP.NET Core 6 MVC project. But when I run the project I couldn't see any translation from my resources folder.
Here is my program.cs code:
builder.Services....
-2
votes
1
answer
498
views
How to connect appsettings.json with IConfiguration on worker service c#
I was creating a background service and I keep the database connection sentence on the appsettings.json file, which I need to access through program.cs. I am using .Net 6 version. How can I access it ...
2
votes
1
answer
3k
views
Microsoft.AspNetCore.Razor replacement?
On the MS website itself they advice to use the Microsoft.AspNetCore.Razor namespace for building custom tags: https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/authoring?view=...