Edi Wang

.NET and Azure Developer

Posts in January 2019

Recommended Visual Studio Configuration for .NET Core Development

Visual Studio has always been a good friend to .NET developers, although VS Code can do .NET Core development, VS is still having a lot advantages. Let's see how to make Visual Studio more handy for .NET Core development. Basic Configuration First, please be advised, not all versions of Visual Studio supports .NET Core development, even some early version of VS2017. Some people may mistake for …
.NET Visual Studio

ASP.NET Core Dependency Injection in ActionFilterAttribute

In ASP.NET Core, we can easily use constructor injection to make Dependent Injections on components such as Controller and ViewComponent. But how to do it with ActionFilterAttribute? The Problem My blog system has an ActionFilter for deleting subscription files, and I want to log errors when an exception happens. I use NLog as the logging component, so I need to use LogManager. …
.NET Dependency Injection

Caveats in ASP.NET Core Data Protection

ASP.NET Core provides a built-in Data Protection mechanism to let us encrypt or decrypt sensitive data. There are some limitations that can cause problems while bringing convenience. I met some problems these days. My Scenario My blog system has a feature to send email notifications, so you need to configure an email account to let the program use that account to send mail to an administrator …
.NET AES Encryption

Auto Refresh Settings Changes in ASP.NET Core Runtime

In ASP.NET Core, if you modify the settings in appsettings.json, you will have to restart the site to take effect. Is there a way to refresh and apply it automatically after you modify the settings? Background Let's take a look at a website created by ASP.NET Core default templates. It includes two settings files: appsettings.json appsettings.Development.json The former one is used in production …
.NET ASP.NET