Kristoffer Strube

Kristoffer Strube

Denmark
16 posts
How to fix Blazor WASM base path problems

A lot of people were intrigued when we got to know that Blazor WASM would come with features like client-side routing. But Blazor WASM applications are still Single Page Applications (SPAs) at their core. This means that they have the same restrictions as any other SPA framework. In this post, ...

How to add User-Agent header to HttpClient in .NET

An intrinsic part of the modern web application is the ability to use external APIs and webpages. In .NET this is done using the HttpClient class. The HttpClient class does not add the field User-Agent out of the box. According to the HTTP standard, it is recommended that this is ...

Call anonymous C# functions from JS in Blazor WASM

In this article, we will look at how we can call C# functions from a JS library in Blazor WASM. This can be useful to integrate with existing JS libraries that react to different events. This article is a continuation of a project made in our other article Wrapping JavaScript ...

How to send push notifications to a browser in ASP.NET Core

Progressive Web Apps (PWAs) enables a website to make make a lot of interactions that are app-like. Among these are Push Notifications. This is a functionality that enables you to make native notifications for many different devices and to invoke these notifications even when the browser is not active. A ...

Wrapping JavaScript libraries in Blazor WebAssembly/WASM

Blazor WebAssembly is one of the newest front-end frameworks on the block. It enables you to write frontend in C# and makes it possible to use many of the .NET libraries that you already know. Most websites use some JavaScript libraries that make it easier to make complex animations, self-aligning ...

How to secure ASP.NET Core with OAuth and JSON Web Tokens

OAuth 2.0 is an authorization standard, that you probably already used somehow. When a service needs information from your GitHub or Google account, you authorize that using OAuth before they can get the data. To secure your API with OAuth there are a couple of options already like Identity ...

Paid subscriptions with ASP.NET Core and Stripe Billing

Stripe is a platform that makes it possible to make online payments in many different ways. One potential use case is a monthly or yearly subscription for a service on your platform. Since SCA was enforced in September 2019 in Europe, Stripe has made a lot of changes to their ...

Common exceptions and fixes in Entity Framework and SQL Server

When starting to work with Entity Framework and SQL Server, you often run into the same errors. Sometimes these errors are caused by missing permissions for the database connection, and sometimes it's caused the way that the database is accessed. In this article, we will go through some of the ...

Convert images to WebP with ASP.NET Core - Better than png/jpg files?

Many websites rely on user-uploaded images as content and want to be able to present as much content as possible to their users at a tolerable speed. Google has developed an image format called WebP, which packs as much detail as PNGs or JPEGs, but it uses files up to ...