WebLog

Server-side, client-side, code snippets, scripts, automation, best practices, proven approaches, tips & tricks...

HTML5 localStorage with expiry with vanilla JavaScript

Using HTML5 localStorage with expiry
0
HTML5 comes with a lot of handy features which can really improve user experience of your web application significantly if you use them wisely. Caching cold data on the client, such as lookups can significantly save the amount of traffic, page load time and even you backed services load. One of the HTML5 features that can help you do this are sessionStorage and localStorage...read more

Extending Serilog with additional values to log

Adding additional information to log in .NET Core application with Serilog
0
If you are building .NET Core application your choice for logger library is most likely Serilog. It is really powerful and easy to use library which allows you easy logging in all levels in your application. One of the best features it has is easy extending of the data you want to have in your logs...read more

Using custom request and response serializers in ASP.NET Core

Configuring input and output serailzer/deserialier in ASP.NET Core pipeline
 
0
This is not a new subject and the support for handling WebApi input and output was introduced in .NET Core 2.0 and it's been there since then. There are couple of useful pages out there and it is even well documented on Microsoft official page Custom formatters in ASP.NET Core Web API...read more

Setting up .NET Core development environment on Ubuntu Linux

A quick guide for switching from Windows based Visual Studio 2017 to Visual Studio Code
0
With growing popularity of dotnet Core, Git and Docker, developers who used to work mainly on Windows are now getting used to CLI environment and obviously Linux. Windows is still a development environment platform of choice, bit since Microsoft already developed and published Visual Studio Code as a cross platform IDE for Windows, Linux and Mac. Although it is still not mature as Visual Studio 2017, it is a decent tool for .NET Core applications development...read more

Reloading the cache automatically once expired is ASP.NET MVC

Load values to in memory cache as soon as they expire in ASP.NET MVC
0
In memory caching is not a bullet proof way of caching data in an application, especially if this application is distributed. The lack of synchronization between nodes can cause you application to misbehave showing wrong data or even throwing exceptions and crashing. This is one of the main reasons why distributed caching is the best way of doing the caching in your web application. But not all applications you might be developing need to run as distributed on multiple machines...read more

Simple script for building and publishing .NET Core application to Docker

Build and publish .NET Core application to Docker container or Kubernetes
0
Recently I wanted to try to spin up a simple .NET Core application on my local cluster which I built in my previous article Manual setup of Kubernetes cluster on a Virtual Machine with kubeadm. The problem I had is that I needed to test applications in this cluster and deploy them as service in order to monitor potential issues behavior. As deployment of Kubernetes service needs an image to pull from, I decided to use dockerhub to push my test images, but they first needed to be created. ...read more

Get most visited pages of your website from Google Analytics using C#

List most visited website pages from Google analytics in your .NET application code
0
If you have a website like this one with articles and you would like to suggest most visited articles to your visitors, there are few ways to do this. One of them is definitely a custom solution that can track and store count of every visit per page you have, or without any re-inventing of wheel you can just hook to Google Analytics API to pull the data...read more

Creating Windows service and Linux daemon with the same code base in .NET

Cross-platform service with C# and .NET Framework
 
0
Few months back I wrote an article on how to create Linux daemon in .NET Core using generic host class introduced in 2.1 version of .NET Core. This code works just great on Linux OS when configured as a daemon in systemd and provides more less same concept you would have with Windows Service written in .NET Framework 4.x. The code works just fine on both Windows and Linux hosts, but because it is compiled as a Console Application, you do not really get to run it on your Windows machine as a Service...read more

Minify ASP.NET MVC Core response using custom middleware and pipeline

Html response content minification on the fly in ASP.NET Core
0
For my website, since it runs on Umbraco 6 and it is basically ASP.NET MVC application. To reduce load time and increase website performances I decided to alternate the response of the application and minify it using simple regular expression. Initially I was trying to do this with YUI Compressor library which has .NET port as NuGet YUICompressor.NET which works fine in most of the cases, but in my case does not skip PRE tags which I use for code snippets on the website...read more

Background working scheduled task in ASP.NET Core MVC application

Using Quartz for scheduling background tasks in .NET Core MVC applications
 
0
Caching common data like lookups for example in memory of your app can increase significantly your MVC web application performances and response time. Of course this data has to be periodically refreshed. You can use various approaches to refresh data including expiry, but this can create potential bottle necks in your application since once data expires, you will use request thread to pull the data, cache and serve the request response back...read more

Simple pixel conversion tracking implementation in ASP.NET Core WebApi

Conversion tracking implementation using pixel method in ASP.NET Core
 
0
Pixel tracking, although it is the oldest method for tracking conversions in marketing, it is still used widely and some big companies like Facebook are still overing it as one of the methods for tracking the conversions of on your web pages. Tracking conversion via pixel method is still widely used because of it's simplicity...read more

Limit number of tasks running at the same time in .NET

How to throttle number of running tasks to a specific number in C#
0
Limiting the number concurrently running Tasks is not that often requirement in a code, but eventually you'll find yourself in the situation that for the most likely performance issues you'll have to limit number of concurrently running Tasks. One of these situations is when you have long running operations in the Task. If you spin up to many Tasks you will seriously degrade your application performance...read more

JavaScript

read more

Umbraco CMS

read more

.NET

read more

SQL/T-SQL

read more