Thomas Ardal

Thomas Ardal

Denmark
205 posts
Web.config location element demystified

I haven't actually met a lot of people who knew the details about the hierarchy of Web.config files and how to utilize the location element. In fact, I've heard multiple people ask "why is there a Web.config file in the Views folder of my MVC application?". Even ASP. ...

Web.config redirects with rewrite rules - https, www, and more

Rewrite rules is a powerful feature in IIS. Common tasks like redirecting www to non-www (or the other way around), implementing canonical URLs, redirecting to HTTPS, and similar tasks are documented right there in your Web.config file. In this post, you will learn about the syntax of rewrite rules ...

Instant errors on SMS from ASP.NET Core with Twilio and elmah.io

This post was originally published on the Twilio blog: https://www.twilio.com/blog/real-time-sms-error-messages-asp-net-core-elmah-ioGetting instant notifications when an error happens on a website can mean life and death for a business. The faster developers fix the bug, the fewer users get frustrated with your website. Using elmah.io and ...

Web.config transformations - The definitive syntax guide

Back when Visual Studio 2010 were the coolest kid on the block, everyone talked about the new Web.config transformation feature. The intentions with transformations were a bit different back then, but still very relevant for ASP.NET, MVC and Web API projects. In this post, I'll explain everything you ...

Debugging System.AccessViolationException - DllImport hell

For this post in the series Debugging common .NET exceptions, I'll present an exception that will be uncommon for most of you and cause recurring nightmares for the rest: System.AccessViolationException. The exception typically happens when unmanaged code tries to read or write from/to memory that hasn't been allocated ...

Debugging System.AggregateException - even in async code

We are here once again to help you debug common .NET exceptions. This time I want to help you debug the rather generic System.AggregateException. As the name implies, AggregateException is used to batch one or more exceptions together in a single exception. In this post, I'll show you why ...

The ultimate guide to connection strings in web.config

Connection strings in web.config can be both powerful and challenging. The times were you would just remote desktop to production and change settings inside your ASP.NET web.config file is long gone. So, should you keep specifying connection strings using the connectionStrings element in web.config? Stay tuned ...

log4net Tutorial - The Complete Guide for beginners and pros

log4net is still one of the most commonly used logging frameworks for .NET. While originally being a port of the log4j logging framework for Java, a lot has happened over the years, to make log4net a unique logging option for .NET/C# developers. This post is a collection of descriptions, ...

Debugging System.UnauthorizedAccessException (often followed by: Access to the path is denied)

It's time for another post in our series about Debugging common .NET exceptions. Today, I want to introduce you to System.UnauthorizedAccessException. The exception is typically caused by an IO error, but other issues like security restrictions are also known to utilize this error. Let's dig in!Handling the errorCatching ...