Category Archives: General .NET

Issues related to general .NET and C# development

HttpClient follow 302 redirects with .NET Core

The HttpClient in .NET Core will not automatically follow a 302 (or 301) redirect. You need to specify that you allow this. use the HttpClientHandler to do this: Now your code will follow up to 2 redirections. Please note that … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , , , | Leave a comment

C# Remove Duplicates from List with LINQ

C# LINQ do have a Distinct() method that works on simple types: For non-simple types, you have 2 options, but first lets make a non-simple type, a class: OPTION 1: IMPLEMENT AN EQUALITYCOMPARER The equalitycomparer is a class that is … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , | Leave a comment

Read and Write blob file from Microsoft Azure Storage with .NET Core

The documentation on the Azure Storage Blobs are a little fuzzy, as the NuGet packages and the approach have changed over time. The latest NuGet Package is now called: Azure.Storage.Blobs The concept of blob storages are the same though: You … Continue reading

Posted in .net, .NET Core, c#, General .NET, Microsoft Azure | Tagged , | 1 Comment

Read and Write Azure Queue with .NET Core

The documentation around Azure Queues and .NET Core is a little fuzzy, as the approach have changed slightly over the last updates. Previously you had a shared Storage Account NuGet Package that gave access to Queues, Blob Storage and Table … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , , | Leave a comment

Azure.Storage.Queues QueueMessage Deserialize JSON with .NET Core

The documentation around .NET QueueMessage is a little fuzzy so depending on the version of your NuGet libraries might differ in properties. This article uses the Azure.Storage.Queues, Version=12.7.0.0. If you, like me, have systems writing JSON messages to the queue, … Continue reading

Posted in .net, .NET Core, c#, General .NET, Microsoft Azure | Tagged , , , , , | 1 Comment

C# Using Dapper as your SQL framework in .NET Core

Dapper is a easy to use object mapper for .NET and .NET Core, an it can be used a variety of ways. I use Dapper instead of Entity Framework because it makes my code less complex. BASICS OF DAPPER: THE … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , | Leave a comment

C# Remove specific Querystring parameters from URL

These 2 extension methods will remove specific query string parameters from an URL in a safe manner. METHOD #1: SPECIFY THE PARAMETERS THAT SHOULD GO (NEGATIVE LIST): Usage/Test cases: METHOD #2: SPECIFY THE PARAMETERS THAT MAY STAY (POSITIVE LIST): Usage/Test … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , | 3 Comments

Sitecore ComputedIndexField extends your SOLR index

The Sitecore SOLR index is your quick access to Sitecore content. And you can extend this access by adding computed index fields. This is a way of enriching your searches with content that is not part of your Sitecore templates, … Continue reading

Posted in General .NET, Sitecore, Sitecore 5, Sitecore 6, Sitecore 7, Sitecore 8, Sitecore 9 | Tagged , , | Leave a comment

Handling “415 Unsupported Media Type” in .NET Core API

The default content type for .NET Core API’s is application/json. So if the content-type is left out, or another content type is used, you will get a “415 Unsupported Media Type”: This is for example true if you develop an … Continue reading

Posted in .NET Core, c#, General .NET | Tagged , , | Leave a comment

C# Newtonsoft camelCasing the serialized JSON output

JSON love to be camelCased, while the C# Model class hates it. This comes down to coding style, which is – among developers – taken more seriously than politics and religion. But fear not, with Newtonsoft (or is it newtonSoft … Continue reading

Posted in .net, .NET Core, c#, General .NET | Tagged , , , , , | Leave a comment