Category "asp.net-core"

Update authentication Cookie in ASP.net CORE 3

In ASP.net CORE 3 app, I use authentication cookie without Identity. Here is the code when a user log in. string securityStamp = Guid.NewGuid().ToString(); var

How do I make a .NET Core 6 Top-Level statement template async?

I'm follwoing this guide: https://docs.microsoft.com/en-us/dotnet/core/extensions/configuration and I don't understand how to make my application work as an asy

There is already an object named 'Id' in the database. Could not create constraint or index

im using EF core 3.1 and trying to Update-Database after adding migration, but im getting this error "There is already an object named 'Id' in the database. Cou

Keep ModelState After Redirect inside ExceptionFilterAttribute

I have a Mediatr pipeline behaviour which handles validation as a cross cutting concern, using FluentValidation it throws a ValidationException containing the v

Blazor Server App JavaScript Libraries Not working (Metronic Template)

I have Blazor Server Side app, where I have added JavaScript and CSS Libraries for Metronic Bootstrap Template. The template is fully loaded when I run the app,

ILoggerProvider with generic types

colleagues! Im trying to create app with Onion arch and several GUI. I used lib Log4net as my log provider. I created my own IMyLoger interface at application l

Razor page change image within form by setting a checkbox

On a razor form submit page I would like to change a picture when a checkbox is set, before the form is posted though not trough JavaScript, but by pure razor c

Running a method on timer for the life of Session

I use the following code segmant to authenticate my users to office365 for my organization and create a session cookie. This also allows me to start an SMTP con

Razor Pages Cannot Read File with build action "Content" Properties

I have a resources file name "Index.en-US.resx", initially it was "embedded resources" build action and it worked well in localization. But when it is "embedded

Custom authentication with two ADs in ASP.NET Core

I have an ASP.NET Core 5 app that uses the Identity framework on a Windows server. When the user clicks Submit on the Login page, it needs to Authenticate their

How to select multiple elements into array in Linq query?

Net core application. I have below query in my application var result = sourceProposal.Quotes .Where(x=>x.QuotationId == sourceQuoteId) .FirstO

Unable to cast object of type 'System.Text.Json.JsonElement' to type 'System.IConvertible'

After converting my application into .NET Core 3.1 , the FromBody json attribute is not working . So Ichanged into [FromBody] JsonElement model. After changin

Is it possible to use a dynamic value in asp-route-{value}?

I have Razor Page with the following piece of code to create a link that adds a dynamic value to the route when clicked. This works perfectly. <a class="page

NLog ApplicationInsights - Instrumentation Key from appsettings.json only loading for TelemetryClient

In my .NET 5 aspnetcore application, NLog is mostly working except for loading the Instrumentation Key from appsettings.json for the logger. It seems to be load

Pass multiple parameter to Ajax from link in MVC Core

I have this link <a asp-action="goPay" asp-route-id="@item.Appid" asp-route-mem="@item.Memid" asp-route-amt="@item.Areq" asp-controller="Withdraw" class="btn

How can I reduce the amount of files produced by dotnet publish command line? [closed]

I tried to publish my dotnet app using dotnet publish --output publish --configuration Release but the result not as expected because the last

AddScheme options not loading from appsettings

I have this line in program.cs builder.Services.AddAuthentication() .AddScheme<SharedSecretAuthenticationOptions, SharedSecretAuthenticationHandler>(S

HttpContext GetEndpoint on modified request path .net 5

I'm trying to create a middleware to handle country code in the url. The code i have works great for removing the country code, so it's routed to the correct en

In Asp.Net Core Can't export traces from OpenTelemetry exporter to elastic apm

Recently, I found OpenTelemetry, and I like to use it in my application. First, I created a new Asp.Net Core 5 web API and exported traces on the console. After

REST Api Design - Opinion on a design choice

I have an API that is connected to a database and where I retrieve data. One schema example: The idea is to retrieve all related data based on the Application