How To

How to use FluentValidation in ASP.NET Core
By Tan Lee Published on Dec 30, 2024 445

FluentValidation is an open-source library for validating data in ASP.NET Core applications, helping to maintain clean, organized, and maintainable code.

How to chunk data using LINQ in C#
By Tan Lee Published on Dec 30, 2024 412

The Chunk method in LINQ is a powerful tool for dividing large datasets into smaller, more manageable chunks, improving efficiency in data processing.

How to split strings efficiently in C#
By Tan Lee Published on Dec 30, 2024 419

Optimizing performance in .NET applications involves careful resource management, especially when working with strings.

How to use ref structs in C#
By Tan Lee Published on Dec 30, 2024 245

C# 13 introduces new ways to take advantage of ref structs to optimize memory usage and eliminate garbage collection (GC) overhead.

This package is signed but not by a trusted signer
By Tan Lee Published on Dec 30, 2024 252

The error "This package is signed but not by a trusted signer" typically occurs when you are installing a package on Windows or another system that uses digital signatures to verify the authenticity of the software.

How to convert file data to byte array in C#
By Tan Lee Published on Dec 30, 2024 479

If you're uploading a ZIP file to Azure Blob Storage, you would first need to convert the file into a byte array.

How to get Url Referrer in ASP.NET Core
By Tan Lee Published on Dec 27, 2024 1.7K

In ASP.NET Core, the referrer URL (the page that made the request) can be retrieved from the `Request.Headers` collection, where it is stored under the `Referer` header.

How to get HttpContext.Current in ASP.NET Core
By Tan Lee Published on Dec 27, 2024 794

In ASP.NET Core, `HttpContext.Current` was removed. Instead, `HttpContext` is injected into services, controllers, and middleware via dependency injection, and can be accessed using the `IHttpContextAccessor` interface.

How to read Configuration Values from appsettings.json in ASP.NET Core
By Tan Lee Published on Dec 27, 2024 1.11K

To access the values from the configuration file, you need to set up a configuration system in the Startup.cs class.

How to add link parameter to asp tag helpers in ASP.NET Core
By Tan Lee Published on Dec 27, 2024 523

You can use the asp-route- attribute prefix to specify route parameters in ASP.NET Core tag helpers.

How to Remove ASP.NET server headers
By Tan Lee Published on Dec 27, 2024 355

IIS (Internet Information Services) web server sometimes sends HTTP headers that can disclose sensitive server information.

Avoiding the Common Pitfalls of the == Operator in C#
By Tan Lee Published on Dec 27, 2024 310

If you encounter an issue with the equality operator (==), specifically when comparing values of different types, extra caution is needed.