Quantcast
Channel: Brian Pedersen's Sitecore and .NET Blog
Browsing all 286 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

ASP.Net Core API – “‘s’ is an invalid start of a value. Path: $ | LineNumber:...

If you create an ASP.Net Core API Controller, and you wish to create an endpoint that can accept any string, you would expect this to be correct: using Microsoft.ApplicationInsights; using...

View Article


Image may be NSFW.
Clik here to view.

Sitecore use global and environment variables in config files

The Sitecore config files are a complex machine and it requires a healthy mind to work with it. Fortunately Sitecore have implemented a few tricks to ease our pain. This article focuses on 2 parts:...

View Article


Image may be NSFW.
Clik here to view.

.NET Core Catch Model Binding Exceptions

In .NET Core, if you create an API project, and you have an controller receiving an object you defined yourself, the controller will not be called if you use the wrong model, or if the model is not in...

View Article

Image may be NSFW.
Clik here to view.

Sitecore and Application Insights – How to remove 90% of all log lines...

In this article I will explain how you can remove up to 90% of all log lines from the Application Insights log, but still keep every log line in the file log. All of this without loosing any important...

View Article

Image may be NSFW.
Clik here to view.

.NET Core Api – Catch exceptions using a middleware

In .NET Core, we are starting to get used to the fact that nothing comes for free, and in the world of ultimate freedom of choice, every feature needs to be implemented by us. This includes error...

View Article


Image may be NSFW.
Clik here to view.

Sitecore use item:deleting event to avoid deletion of items

The Sitecore extendable model allows you to build business rules into your Sitecore solution. This is an example where I disallow deletion of certain items when a certain business rule is true. This...

View Article

Image may be NSFW.
Clik here to view.

Sitecore Create/Read/Update/Delete/Copy/Move/Rename item – the beginners guide

New Sitecorians often ask the most trivial questions, and I am happy to answer them. This question popped up lately: How do you perform basic CRUD operations on your Sitecore items? Well, it’s easy:...

View Article

Image may be NSFW.
Clik here to view.

Command line parameters in .NET Core Console Applications

When implementing .NET Core console applications, you can extract the command line parameters from the void Main(string[] args) method, but it can be a little tedious to do so. To help with the...

View Article


Image may be NSFW.
Clik here to view.

Azure App Configuration – Getting the connection string from appsettings.json

Azure App Configuration is a services that provides a central place to manage application settings, and it provides cool features like feature flags and auto refresh of settings when they are changed....

View Article


Image may be NSFW.
Clik here to view.

Application Insights not working in .NET Core Console Application – Remember...

My .NET Core console application did not write to my Application Insights instance. Well, it did, but only sometimes. Writing to Application Insights is done asynchronously, usually every 30 seconds or...

View Article

Image may be NSFW.
Clik here to view.

C# Get expiry timestamp from JWT token

JWT tokens (or Json Web Tokens) are an open-standard the defines a way to transmit information between 2 parties in a secure manner. Identity Server 4 uses JWT as a security token. These tokens have an...

View Article

Image may be NSFW.
Clik here to view.

Sync Sitecore content to external database

The legal department of the client requested that we sync parts of the Sitecore tree to an external, system-versioned temporal table, so that we have a full audit trail of changes to these items...

View Article

Image may be NSFW.
Clik here to view.

System.DllNotFoundException: Unable to load DLL ‘sni.dll’ or one of its...

This message happens when deploying my .NET Core 3.1 application to production (when compiling the code to an .exe file), but not when running the application locally. It turns out, that Dapper is...

View Article


Image may be NSFW.
Clik here to view.

.NET Core Worker Services with Application Insights and Serilog

The .NET Core Worker service is yet another tool in the .NET toolbox. They are perfect for background processing like reading from a queue or making health checks. They are cross-platform (of course)...

View Article

Image may be NSFW.
Clik here to view.

HttpClient retry mechanism with .NET Core, Polly and IHttpClientFactory

A lot of HttpClient errors are temporary and is caused by server overload, temporary nerwork timeouts and generic gliches in the Matrix. These scenarios can be dealt with using a retry pattern. In .NET...

View Article


Image may be NSFW.
Clik here to view.

Remove duplicates from XML feed

Apparently XML isn’t dead yet, and today I received a Google Product Feed in the RSS 2.0 XML format. The feed was full of duplicates and my job is to remove them: <?xml version="1.0"...

View Article

Image may be NSFW.
Clik here to view.

Sitecore high memory usage – not always a problem

Sitecore is known to be a real memory hog. Especially the CM server is known to love memory. One of the memory issues that Sitecore faces is the high usage of the Large Object Heap. Heap Fragmentation...

View Article


Image may be NSFW.
Clik here to view.

Sitecore Memory Issues – Every memory optimization trick in the book

My recent post, Sitecore high memory usage – not always a problem, claims that high memory usage is not the same as having a memory problem in Sitecore. But the reason you are reading this blog is...

View Article

Image may be NSFW.
Clik here to view.

C# Azure TelemetryClient will leak memory if not implemented as a singleton

I noticed that my classic .net web application would leak memory after I implemented metrics for some background tasks. Memory usage of web application Further investigation showed that my...

View Article

Image may be NSFW.
Clik here to view.

Manipulating XML Google Merchant Data using C# and LINQ

Receiving a Google Merchant Data feed (also known as a Google Product Feed) can be fairly easily manipulated on import time using a little C# and LINQ. The feed is basically a XML RSS 2.0 feed with...

View Article
Browsing all 286 articles
Browse latest View live