Getting data from configuration file, we can use something like this appsettings.json And we can read the values using this code, notice the use of magic string. Magic strings are problematic because they can be difficult to maintain, error-prone, and can lead to issues such as typos, spelling mistakes, and inconsistency. Instead we can create…More
Deploy NextJS to Azure Web Service/ IIS
There are two steps required to deploy NextJS to IIS server or Azure Web Service:First: Prepare the NextJs Application.Second: Prepare the IIS Server or Azure Web Service depeneding on where you want to deploy tour application. Preparing NextJs Application:1- Create custom server file in the root of the application, create server.js file that contains code…More
Multiple Implementation of Interface in ASP.net core
This approach utilizes the new feature default interface methods introduced in C# 8.0, so we will need .NET Core 3.x or newer versions to implement this approach. Let’s say we have the following interface: This interface has multiple implementations with two different classes, Visa and Master: The services registered as the following: For the sake…More
AutoMapper with Entity Framework the right way
AutoMapper with Entity Framework the right wayMore
How Sessions works internally in ASP.net core
Http requests are stateless, sessions are used to maintain/persist data between http requests, it’s one of many approaches used in asp.net for state management. In this post, I will explain how and where the session data are stored, how the data is secured, managed and retrieved. I will not talk about how to add and…More
Setting up Serilog in ASP.NET core with JSON configuration and write the logs to JSON formatted file
Serilog is a diagnostic logging library for .NET applications. It is easy to set up, has a clean API, and runs on all recent .NET platforms.I assume you already have an ASP.NET application, so I will start directly with the required steps to set up Serilog in that application. Step 1) Initially, we will need…More
Enable https in local NextJS application
When working on development environment, it’s good practice to keep the setting as close as possible to the production environment, this is one of the reason why we want to use https enabled project during the development.For NextJs project, we need the following to enable the https:1- Self-Signed Certificate (.cert & .key) files.2- Create server.js…More