UseStatusCodePagesWithReExecute .net 6

net logo

I got some problem when trying to use custom error pages in a .net 6 mvc web app. Using UseStatusCodePagesWithReExecute to redirect to an error controller on exceptions like 404 or 500 response status. But the error controller never got…

Changing password on a user using MMC

warning from mmc

Warning message below is from changing a password on a user in Microsoft Management Console (MMC) Windows 10. The warning message was quite funny, it’s in Swedish but the warning is: ..”Only use this command if a user has forgotten…

Change keyboard layout in Kali Linux

kali-linux

Default keyboard layout for Kali Linux is english. One command you can use for changing keyboard layout is:setxkbmap <lang-code> So for instance if you would like to change the layout to swedish the command is: setxkbmap se

Convert SSL certificate to PFX using OpenSSL

ssl certificate

If you want to create a password protected PFX file from certificate file and a private key you can use OpenSSL. Follow these steps to create a PFX file. 1. Download the SSL/TLS tookit from 2. Run this command…

.NET MVC – Illegal characters in path

ScenarioRender a ASP.NET MVC Razor view with a model from the controller. Error / ExceptionSystem.ArgumentException: Illegal characters in path. CauseThe model from the controller was returning JSON and the view had declared “@model string” to handle the JSON. SolutionUpdates in…

Error when reading from PFX certificate SSL/TLS

Case Establish a secure connection to a server. Authentication with certificate. Error message The request was aborted: Could not create SSL/TLS secure channel. Start Microsoft Management Console, either from control panel or by run command “mmc”. In MMC select File…

Problems connecting to WCF service

Trying to connect to a WCF-service but get some error messages: The HTTP request is unauthorized with client authentication scheme Anonymous The authentication header received from the server was Basic The provided URI scheme https is invalid expected http The…

Copy files using a runtime created batch file C#

If you would like to copy one or several files using a batch file. The command for that is “copy {target} {destination}”. It’s also possible to use wildcards i.e “copy *.txt c:\temp”. To create a bat (batch) file on runtime…

Insert default value SQL primary key

I have a table in Microsoft SQL Server where insert or updates isn’t possible. Table is only responsible to increment a unique id. The table looks like this: CREATE TABLE [dbo].[CustomerOrderNumbers]( [customerOrderNumberId] [int] IDENTITY(1,1) NOT NULL, [createdOn] [datetime] NOT NULL,…