Collect all kinds of programming exceptions and fault solutions.

Custom OData Formatter for netcore 3.1 WebApi Issues

So i am building a service that has to be consumed through OData and i am having a really difficult time figuring how to add custom formatters to it. I need my OData serializer to ignore null value...

AspNet.Identity.Core : how to create a user manually - HashPassword

I have a .NET core app, it works perfectly.
But I need to create a batch of new users, by inserting directly into the database.
The problem now is that when I try to login, it failed...
I suspect a

Trying to enforce ASP.NET core MVC to use HTTPS

I have tried to follow a few tutorials and this is what I've got:
adding to ConfigureServices,
services.AddHttpsRedirection(options =>
options.RedirectStatusCode = StatusCo... core 3.1 identity roles getting deleted

I am having an issue with identity roles in ASP.Net core 3.1. The data inside the AspNetRoleUserRoles keeps getting deleted.
I am not able to find out what is causing it. Is there a way to log these

CreatedAtAction throws InvalidOperationException when using API Versioning

EDIT: here's a repo which simulates the error.
I'm building an API using ASP.NET Core together with ApiVersioning. My controllers are annotated with [Route("api/v{version:apiVersion/[controlle...

Why is the user automatically logged out after 60 minutes, using cookie authentication

We have an Blazor WASM app and want to authenticate an user by Cookie-Authentication. The Problem:
We want to keep the login for 30 days, but the user logs out after 60 minutes. We have tried multi...

Unauthorized error when calling from Core to Asp.Net MVC Web API with bindings

I have created two applications one is Asp.Net Core Web API and another one is Asp.Net Web API. I have deployed both on IIS on the server.
I have given binding two applications like test-core.testd...

Kestrel HTTPS Endpoint with Wildcard Certificate

We are facing an issue when we load a wildcard certificate for a Kestrel ASP.NET Web API host using the following appsettings.json file:
"Kestrel": {
"EndPoints": {

How to bring Twitter Tweet with Twitter Card to work?

I try to implement a Twitter Tweet button on my web page ( core console app) with Twitter Card.
Goal: submit link to my web page, title, description and image (over the twitter meta tags) wi...

Getting a 400 Bad Request error when trying to call PATCH endpoint on .Net Core 3.1 Web API

I'm getting a 400 Bad Request when trying to calling a PATCH endpoint on my Web API (.Net Core 3.1) and I cannot figure out why. My action method looks like this:
using Microsoft.AspNetCore.JsonPat...

OpenIdConnectOptions.ResponseMode not being set properly

I am setting responsemode to "form_post" yet when I try to login to my IDP, I get this error:
Exception: An OpenID Connect response cannot contain an identity token or an access token when

Error 506 with GlobalPayments HPP, Invalid Content-type

I'm trying to implement full-page redirect for payment in .NET Core WebApp. I'm using provided example code (.NET server side), except I use the test site from here.
When clicking the button I see ...

Can I create an Identity Server 4 ASP.NET Core API using 2 different token authentication middleware?

I am trying to figure out if its possible to write an ASP.NET Core API that consumes an identity server token using either Reference Tokens or JWT tokens based on whatever I've configured my identity

.net code to Create PTR Record for Microsoft DNS

Please anyone provide proper .netCore code to Create PTR record for Microsoft DNS.
I am getting in Powershell but I dont know powershell script . I didnt get any answer refering to my question.

Problem with pass data to controller - update data

I have a problem with passing data from view to controller... When I was clicked button which sending POST - I have got only data for Category.Name. No subcategories, no ids etc. I am thinking I do

How to add an HTTP Header to all outbound HTTP Requests in ASP.NET Core

I would like to add an HTTP Header to all outbound HTTP Requests from my ASP.NET Core website (similar to the Application Insights correlation headers)
I have tried adding a DelegatingHandler in my

Attempting Authentication via Azure AD B2C and Authorization via groups from AAD

So I followed the below examples:
Hosted Blazor Web Assembly AAD B2C: here
Azure Active Directory groups and roles : here
I first implemented Hosted Blazor Web Assembly and got that working fine. W...

Bind date and time in core mvc view

I can't Bind datetime to in view
this is the model
public class ListaDisponibiliModel
[DisplayFormat(DataFormatString = "{0:f}", ApplyFormatInEditMode = true)]
public DateTime

Some extensions called on Startup class, are called but the configured options aren't keep it

This is my extension
And i add the call on the startup of this way
When is debugged the extensions is fine, but when i try to call some service I get this error

Issue with creating JWT in .NET core

I'm using core to create a JWT and having issues with it.
I need to create the JWT like the pseudo code below:
var headers = base64URLencode(HeaderData);
var payload = base64URLencode(paylo...

Reusing Razor view component in list context

Say, on a page I have a list of items and a Delete button next to each. Upon clicking, I want to show a pop-up with a confirmation message.
The confirmation dialog and the deletion functionality ar...

Migration with two different connection strings in Entity Framework

I have one DbContext and two databases, one for debugging / development (local) and one for production (online). I switch them with the appsetting.Development.json and appsettings.Production.json f...

ASP.NET Core : get stored procedure results to a view model

I have a view model called TdetailsVM as below:
public class TdetailsVM
public Tournaments tourney { get; set; }
public List<Participants> currentlyjoined { get; set; }
Now in the

Log in with Azure AD and get a UserManager

I have two websites, a "customer" website that contains local users stored in Identity tables in a SQL Server database, and a "management" website the logs in users via our Azur...

Asp .net core razor pages urldata

In the asp .net razor pages, there is the built in urldata. I use it to easily read from the url.

Launch IIS Express to run ASP.NET Core Apps

I wish to run my ASP.NET Core App by launching it from IIS Express using command line.
I stumbled across this article which says
So in fact Visual Studio silently adds the two environment var...

NavigationError on NavigateTo

I'm trying out Blazor ServerSide and created a Component to Redirect To the Login Page when a user is not logged in.
@inject Microsoft.AspNetCore.Components.NavigationManager NavigationManager;

Identity server does not redirect after sucessfull login

I am trying to set up IdentityServer4 with MVC client.
Everything works fine until I want to add ASP Identity. When I added code to use SQL server and Identity, after sucessfull login Identity ser...

Azure Service Fabric Dyanamic Port Conflict

I have been wondering why Service Fabric does not take into account that ports clash and re-hosts the service on a diffrent port.
I have multiple application packages that are used at runtime to c...

asp .net core 3.1 identity server

I have a project that needs to be updated at .net core 3.1. The problem is that i don't know how to use this new feature from 3.1. I have my Identity Server Settings in appsettings.development.json...

Unit Testing ASP.NET Core AAD Auth

I'm using Selenium to Unit Test an Azure AD application in ASP.NET Core MVC web app and I am looking for a better method of logging in the test user besides searching the DOM for login input elemen...

Assigning external style sheet page to razor page in .core web application

As you all know, in all normal .net framework empty web site projects every asp page has a head section in which we specify the external style sheet of that asp page. But I am shifting to .core web