How To
How to use FluentValidation in ASP.NET Core
By Tan Lee Published on Dec 30, 2024 365
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 361
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 347
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 208
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 202
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 407
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.43K
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 665
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 958
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 437
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 310
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 271
If you encounter an issue with the equality operator (==), specifically when comparing values of different types, extra caution is needed.