How to use Filters in ASP.NET Core

Filters are components built into the ASP.NET Core which can help us in controlling the execution of a request at specific stages of the request pipeline. These come into picture post the middleware execution, when the MVC middleware matches a Route and a specific Action is invoked.

Creating a Simple RSS Feed with ASP.NET Core Web API

While the terminology might seem alien to us, but at its core its just a web service which returns data from its data source in a predefined XML schema called as RSS. In this article, let's build a simple endpoint in our ASP.NET Core WebAPI which can return RSS feed from a Posts database.

How do you handle errors Globally in ASP.NET Core?

We can make use of the built-in UseExceptionHandler() middleware for catching Global Errors in ASP.NET Core.

app.UseExceptionHandler(err =>
   {
        err.Run(async ctx =>
        {
            context.Response.StatusCode = 500;
            context.Response.ContentType = "application/json";
            // gets error detail
            var ex =  context.Features.Get<IExceptionHandlerPathFeature>();
            var error = new MyResponseModel() { Content = ex.Error.Message };
            await context.Response.WriteAsync(JsonConvert.SerializeObject(error));
        });
    });