Thomas Ardal

Thomas Ardal

Meet Thomas, the founder and developer behind elmah.io. Thomas blogs about everything technical from C# and ASP.NET Core to machine learning.

Denmark
313 posts
Upload and resize an image with ASP.NET Core and ImageSharp

While migrating our web app to ASP.NET Core, I had to find a new way for the user to upload and resize a profile photo. We used the WebImage class in ASP.NET MVC, which unfortunately isn't available in Core. In this post, I will show you ...

The ASP.NET Core security headers guide

TOC Three years ago I wrote a tutorial about security headers in ASP.NET MVC. A lot happened since then and ASP.NET Core is the framework everyone should be on eventually. Time for an updated version for Core! This post is part of the series ASP.NET Security. I& ...

ASP.NET Core middleware with Roslyn Analyzers - Part 2

This is the second post in the series about Roslyn analyzers with ASP.NET Core middleware. If you haven't read part 1 already, go ahead a do that for a general introduction. In this post, I'll continue the example from the first post and start looking ...

Generate a PDF from ASP.NET Core for free

No matter what system I have been working on, generating PDF files already snuck in somehow. Whether it is generating an invoice or a report of data, PDF files are still an essential part of most web applications. In this post, I'll show you how to generate a ...

ASP.NET Core middleware with Roslyn Analyzers - Part 1

ASP.NET Core middleware is a clever way to configure features like authentication, routing, and error logging in ASP.NET Core. Adding the different pieces of middleware and in the right order can be quite a nightmare, though. In this post, I'll show you how Roslyn Analyzers can ...

How to send emails from C#/.NET - The definitive tutorial

TOC I just answered some questions from a friend of mine about a subject that I believe would fit within my how-to-series of posts. That's where I try to come up with updated answers to common C# challenges like converting between formats or saving content to a file. ...

C# how to convert a string to int

TOC Time for a new post in my how-to series. In this series, I try to provide updated answers for common .NET/C# questions. I found that when googling common terms like "convert string to int", "write to a file", and similar, I would often get ...

Publish a self-contained .NET app on Azure DevOps

I had a problem today that I ended up spending quite some time resolving. We have some internal CLI's that we have been migrating to .NET Core lately. Rather than having to clone the code and build it when needed, I wanted to set up an automated build, ...

ASP.NET Core request logging middleware

I needed to debug an error logged through Microsoft.Extensions.Logging (MEL) on one of our ASP.NET Core-based services today. Usually, when getting errors logged through MEL, all of the HTTP context data is logged as part of the error, making it easy to spot why an error happened ...