Logging in .NET Core using ILogger

Logging is an important part of software development. It helps us know that tasks have been completed, monitor applications and provides a trail to follow when things don’t work. Microsoft has included a logging framework in .NET Core and ASP.NET Core to allow developers to easily implement logging and choose their own logging provider (thisContinue reading Logging in .NET Core using ILogger

Using a Vue.js SPA with ASP.NET Core Web API

I recently started working on a new side project and decided to implement it as a single page application (SPA). For this, I chose to build an API powered by an ASP.NET Core Web API and a Vue.js powered front-end to consume the API. I could find templates included in Visual Studio for AngularJS andContinue reading Using a Vue.js SPA with ASP.NET Core Web API

Handling null values in C#

Handling null values in C# and .NET comes with the territory. Null values were introduced by Tony Hoare in mid-1960s to represent missing or unknown data. This is a useful capability but it has resulted in null reference exceptions becoming one of the most common causes of bugs which developers face. As a result, Tony Hoare now calls the nullContinue reading Handling null values in C#

What makes a good log message?

Logging can provide important information about the behaviour of software applications. It allows operations staff to monitor application performance and gives developers a trail to follow when trying to diagnose the cause of errors. With this in mind, it is worth considering what is good information to record in a log file and what formatContinue reading What makes a good log message?

How to send emails in .NET Core with MimeKit and Mailkit

The ability for an application to send emails is a very common requirement. This can be for emails such as providing account information, sending marketing emails or even a password reset email. This post will cover how to send an email using MimeKit and MailKit from an ASP.NET Core MVC web application. I will use MailSlurper as a local SMTP server toContinue reading How to send emails in .NET Core with MimeKit and Mailkit

Changing Query String values in ASP.NET MVC

Recently I was trying to update a query string by adding or updating a parameter for URLs generated in a partial view. I found an excellent example for achieving this by setting route data here however this didn’t preserve current query string values in the URL. I’ve extended upon that code and updated it to include the queryContinue reading Changing Query String values in ASP.NET MVC

Disabling an ASP.NET MVC input control

I love ASP.NET MVC. It is a great framework to get web apps quickly built. However using the built in HtmlHelper methods on your views isn’t without its issues. An example of this is when trying to disable a HTML input control which has been built using HtmlHelper. You can add the “disabled” attribute which would beContinue reading Disabling an ASP.NET MVC input control

Fixed/Sticky Headers on ASP.NET GridView using jQuery

The GridView control in ASP.NET Web Forms is an extremely useful and quick way of getting data out to the user in a nice tabular format. It does have one weak spot though and that is some of the tags it uses when doing this. Specifically, not putting the header information inside a <thead> tag.Continue reading Fixed/Sticky Headers on ASP.NET GridView using jQuery

Strongly Typed Data in ASP .NET Web Forms

In ASP .NET Web Forms you’ve previously had to use strings to specify which properties you’d like to output when databinding, which would probably end up looking something like the following. In all likelihood it could probably look far less tidy if you’ve ever needed to do any formatting on values you’re about to outputContinue reading Strongly Typed Data in ASP .NET Web Forms