Category "asp.net-core"

(.Net Core) How to test connection to db at startup?

.Net 6.0, EF, Asp.Net Core I'm trying to interrupt my web server's startup if the connection to the db could not be established. I'm thinking that the natural p

Google application credentials in azure app service (aspnet core web api)

So I am using Firebase SDK to send push notifications to my android clients. On local IIS this is how I have configured FirebaseSdk. In Startup.cs I have Fir

How to dynamically change background-color in ASP.NET MVC core?

I had an idea of changing a background color of a div when I click a button. I added a string in my 'Subject' model class as so: [NotMapped] public string Colo

ASP.net Core: There is already an open DataReader associated with this Connection which must be closed first

I have an ASP.Net Core application, and I'm using Microsoft identity, I'm trying to add a page to manage users roles, in the action result i defined a variable

.NET CORE, how to get file location for an exception in a web app, in middleware?

I've seen this question: How can I get the line number and file name from an exception in net Core? And tried the code, but it always says line 0 and no file na

ASP.net Core Identity 3.1

What is the suitable service to provide email confirmation and password reset. i have tried smtp but after six attempts actually it considered those emails as s

Docker errors when trying to build in ARM64 Apple M1: "Failed to resolve full path of the current executable [/proc/self/exe]"

I'm having trouble building docker containers on an Apple M1 The project uses sdk 2.2 which is incompatible with arm64 architecture. So I changed the sdk and as

Ignore global query filter for joined entities

Global query filters are very handy when implementing tenant and soft deletion features. But my problem is is that when i write a query with joins, for instance

Can't start worker service as windows service

So. I created a worker service and want to run it as windows service. It works locally. I installed it to windows server via powershell new-service command. Whe

.Net Route Action Parameter coming back null despite being in url

UPDATE: It works fine is I add another parameter. I have no idea why. Not sure what I am doing wrong, this route looks the same as the other routes, I've looked

Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: The same schemaId is already used for type "X"

The project of .net core WebApi generate the right swagger when a class is generated in one DLL. this solution works fine, the project is compiled and the swagg

How to Bind a List in Model with HTML Form in ASP.NET Core?

I'm unsure what I'm doing wrong when trying to map form values to my model, FieldMappingCollection. I've been able to get the Id and Name back for the model but

How to show a custom 404 page instead of default by Browser? When I'm using my Razor Pages Application

If you type http://google.com/ShowMeYourCustom404Page in your browser and then press Enter. You will be redirect to Google 404 Page. If we apply the same conce

Avoid unnecessary include statements in SQL database query for ASP.NET Core

There are some times where I have a user and would like to check whether they are in the organization that owns the item they are trying to access. Let's say th

Azure Web API giving a 404 when deployed but works locally

We have a .NET Core Web API deployed as an Azure Web App. All endpoint work locally, however, once deployed, we have one controller that is gives us a 404 for a

ASP.NET Core MapFallbackToFile is not handling non-existings urls. Only homepage

I am creating Blazor app. If I navigate to homepage - page loads fine, then I navigate into article e.g. localhost/new-article. Next step is page refresh via F5

How to secure ElmahCore Errprs Dashboard page on ASP.NET CORE API end

I have ASP.NET Core API that is being consumed by an Angular app. Now I have implemented ElmahCore error logging API that shows all errors of Backend API on the

ASP.NET Core 3.1 MVC JWT Login return 401

I have a problem , jwt authentication return 401 Error. Token was created but always return 401 error. I used layered architecture. I tried many things on start

DateTime from view to control to Mapper

i'm trying to pass A DateTime data type to a controller that will call a Mapper to pass it into a db. Additionally the DateTime is taken from a db at first. db

Blazor Hybrid App how to navigate to pages

How can I navigate between Razor pages in an Blazor Hybrid App? I found this explanation: https://docs.microsoft.com/en-us/aspnet/core/blazor/hybrid/routing?vie