Using ASP.NET Core DI to inject objects into ActionFilterAttribute


Let’s assume you want to validate something before a request hits your ASP.NET Core controller’s action method. One of the possible solutions is to create an ActionFilterAttribute and use its OnActionExecutionAsync (in case you like to do it asynchronously) to do the checking. Now if you are depending on something like configuration or even another instance of a class it is going to be tricky.


Spread the love

CORS issues when using Azure AD in ASP.Net Core and Angular

Recently, I wrote a post about using Azure Active Directory (AD) as authentication mechanism for a single page application written in Angular. It also consumed ASP.NET Core 2.0 as API layer an we saw how to wire up the whole thing end to end.

In my approach I redirected user to Azure from client side, however, there are other ways you can follow in which the user is redirected from server to Azure login page. In such cases you might struggle with cross origin resource sharing aka CORS issues as it will be required for the application to behave properly.  (more…)

Spread the love

Setting up VSTS CI/CD for a SPA app using AngularCLI, ASPNetCore (Part 1)

Recently I was assigned to a green field project where we had to create an initial structure of a project which was going to be written in Angular 2 using Angular CLI for front end side and ASP.Net Core for back-end. We had to use VSTS (Visual Studio Team Services) as our source control and build and deployment pipeline. The result was then deployed to Azure Web Apps and the aim was to make this happen.  (more…)

Spread the love