How To

How to Convert varchar to uniqueidentifier in SQL Server
By Tan Lee Published on May 16, 2024 3.67K

To convert a varchar to a uniqueidentifier in SQL Server, you can use the CAST or CONVERT function.

Serialize and Deserialize a Multidimensional Array in JSON using C#
By Tan Lee Published on Dec 25, 2024 1.42K

By default, System.Text.Json does not support serializing or deserializing multidimensional arrays.

How to retrieve the Downloads Directory Path in C#
By Tan Lee Published on Jun 27, 2024 3.87K

In C#, you can retrieve the path to the user's Downloads directory using the Environment class and the SpecialFolder enumeration.

Retrieve a Single Row with Dapper in C#
By Tan Lee Published on Jan 18, 2025 779

When you need to retrieve a single row from a database using Dapper, the simplest approach is to use the QuerySingleOrDefault() method.

How to Convert string to JSON in C#
By Tan Lee Published on Nov 19, 2024 2.93K

You can convert a string to a JSON object in C# using the `JsonSerializer.Deserialize` method from the `System.Text.Json` namespace.

How to use decimal precision and scale in EF Code First
By Tan Lee Published on Jul 11, 2024 1.22K

In C# Entity Framework, when you want to use the Decimal data type for your entity properties, you can follow these steps.

Ignoring Namespaces in XML when Deserializing in C#
By Tan Lee Published on Jan 10, 2025 1.84K

Namespaces in XML can be tricky to handle, especially when you're working with documents that sometimes include them and sometimes do not.

How to convert GUID to Integer in C#
By Tan Lee Published on Nov 10, 2024 989

Converting a GUID to an integer in C# isn't a straightforward process because a GUID is a 128-bit value, while an integer in C# is only 32-bits.

How to Authenticate HTTP requests with cookies from an embedded WebView2
By Tan Lee Published on Mar 07, 2025 303

Automating HTTP calls to web pages or APIs by bypassing Cloudflare Turnstile or other CAPTCHA systems can be achieved by using authentication cookies from a browser embedded in a Windows Forms application.

How to securely reverse-proxy ASP.NET Core
By Tan Lee Published on Mar 07, 2025 400

ASP.NET Core applications are powered by Kestrel, a fast, solid, and reliable web server. While Kestrel is capable of serving as a front-facing server, it's rarely exposed directly to the internet.

How to Retrieve Client IP in ASP.NET Core Behind a Reverse Proxy
By Tan Lee Published on Mar 07, 2025 330

When deploying a web app with both a front-end and API back-end to Azure App Service, you may encounter an issue where the client IP address returned by your API always shows the Azure outbound IP rather than the real client IP.

How to add a computed column in EF Core
By Tan Lee Published on Mar 07, 2025 225

To add a computed column in EF Core, you need to override the DbContext.OnModelCreating() method and specify the computed column using ModelBuilder, similar to the following example: