Required and BindRequired Data Annotations

Required and BindRequired dotnet attributes

In ASP.NET, we have Data Annotations, which are attributes that can be placed above properties or classes to validate them. The default annotations are simple because ASP.NET will create the validation needed for the server and client side. The most used data annotation is [Required]. This validation has a downside, and I have seen it many times from junior programmers. … Read more

Host your ASP.NET Core on Cloud using Nginx and Docker

Docker ASP.NET Core Getting Started

In today’s article, I will show you how to host your website on DigitalOcean’s clouding host ($100 free credit)¬†using Docker containers and Nginx reverse proxy. Configure Docker for ASP.NET Core What is Docker? The containers permit to isolate the application resources, allowing at the same time the sharing of the server resources. There are similar to virtual machines but instead … Read more

Configure NLog in .NET Core Application

Nlog Advance Logging

NLog is a C# library used for logging. It is highly configurable, used by many projects. It supports by default various destinations for logs. I recommend using the NLog or Serilog. These two libraries are very similar and they have the most number of destinations already implemented. NLog configuration The configuration is built on three major properties: Target property sets … Read more

StringBuilder Class in C#

Stringbuilder class in C#

When I learned to program, my professor told me that the String class is immutable. That means you cannot change the memory of that string. A new memory allocation happens whenever you try to modify a string. Use StringBuilder instead of String operators When I was a junior programmer, I used string operators whenever I needed to concatenate two strings. … Read more

WebP Images in C# and ASP.NET

nature image webp format

What is a WebP image? WebP is a new format for images developed by Google, which offers more efficient compression rates (up to 34% smaller) than the old formats like PNG and JPEG. Most websites load many big images. The speed of the website is slow. As a result, the traffic is impacted. All of my websites use this format … Read more