Category Archives for ASP.NET Core

ASP.NET Core Authorization – Using attributes for handlers and requirements

Introduction Dealing with authentication and authorization in ASP.NET Core while working with modern web apps has been much better experience than it was in older versions of ASP.NET. And it’s been further improved with v2. There are few quirks when you work with it enough, but the feeling overall is much better. Besides official documentation […]

Continue reading

ASP.NET Core 2 – Global Model validation

How we (some of us?) do Model validation right now We, developers, use a lot of repetitive code in our ASP.NET (Core) Web API / MVC actions. Inside of our controller actions we usually check if the model is valid by using ModelState property available on MVC’s base controller class: View the code on Gist. The […]

Continue reading

ASP.NET Core – Unit testing IAuthorizationService and dependencies inside of your controller

Unit Testing – IAuthorizationService, Requirement and Handler You have a controller that makes use of IAuthorizationService and you have a custom requirement – implementation of IAuthorizationRequirement. You might also have your custom handler which is an implementation of IAuthorizationHandler. As an honourable .NET Core citizen, you are doing some unit tests for your controller and […]

Continue reading

ASP.NET Core – InvalidOperationException: Cannot find compilation library location for package ‘Microsoft.Win32.Registry’

TL;DR Add following line to your .csproj file: <MvcRazorExcludeRefAssembliesFromPublish>false</MvcRazorExcludeRefAssembliesFromPublish> Introduction I was publishing a project I am working on to web server (Linux) and I had an issue with Razor Pages. However, it seems that this error occurs only when you precompile your Razor views (MVC views, Razor Pages). Why would you do that? Well, […]

Continue reading

ASP.NET Core Interview Questions

Introduction ASP.NET Core and .NET Core have been in development for years already. If you look into ASP.NET Core MVC repository history, you will find commits from July 2013. These are the new frameworks from Microsoft, that are the completely open source and cross-platform. If you want to learn more about ASP.NET Core, you could […]

Continue reading
1 2 3 7