Not so long ago I wrote an article on how we can create our own API gateways using the Ocelot open source library. Since then, I received some questions on how to integrate Ocelot with Identity Server 4 so I thought to share how I managed to achieve this using the Ocelot documentation and some basic Identity Server 4 knowledge. Please note that following these steps I was able to successfully build an API gateway using Ocelot, that used Identity Server 4 JWT tokens to authorize requests and redirect them to the desired downstream path. Continue reading
Working with lists is something developers do almost everyday. One of the most common tasks when we think about lists is sorting them. Fortunately, sorting lists in C# is not very complicated when it comes to primitive types and strings, but are slightly more complicated when we create lists of our own objects. In this tutorial we’ll go through some of the common ways to sort lists in C#.
Update: I have also created a video on this topic so if you think that it’s easier to follow the video, here it is:
Let’s start with a short and simple example. Let’s assume that we create a list of names and we add some names to the list:
List<string> names = new List<string>(); names.Add("John"); names.Add("Dan"); names.Add("Zack"); names.Add("Cristina");
Few days ago I wrote a short tutorial about middleware in ASP.Net Core and I promised to continue the topic, since there are some concepts that I didn’t cover. In the mentioned first tutorial I tried to describe what a middleware pipeline is, why middleware order is important and the importance of the next() delegate. In the second part I will focus more on the Use(), Run() and Map() methods that we can use when setting up the middleware pipeline of an ASP.Net Core application.
Technically speaking Use(), Run() and Map() are extension methods on Microsoft.AspNetCore.Builder.IApplicationBuilder instances. If you look them up, you’ll see something like this: Continue reading
Middleware is a very important topic in ASP.Net Core since it enables you to add very important functionality, like adding necessary configuration to deploy ASP.Net Core and Angular together. But at the same time there are a lot of misunderstandings regarding middleware in ASP.Net Core among developers that are new to the platform. That’s why I think it’s a good start to highlight the most important concepts regarding middleware so that new developers can get started much quicker with ASP.Net Core.
The concept of middleware
I won’t try to give a real and exhaustive definition of middleware (you can find this on the Microsoft documentation). Instead, I will try to depict a picture of how middleware in ASP.Net cor relate to the application you’re developing. So let’s imagine that you already have an ASP.Net Core application that is hosted somewhere and I want to make a request to that application. So when I send my GET request, it will first hit Kestrel, the web server built into ASP.Net Core. For the request, that’s the entry point to the application. Continue reading