How To
What is HSTS
By Tan Lee Published on Feb 27, 2025 285
When you create a new ASP.NET Core application, it comes with a set of middleware to handle typical web application tasks like serving static assets, routing, HTTPS redirection, and exception handling.
HTML5 Validation for ASP.NET Core
By Tan Lee Published on Feb 27, 2025 251
While working on an ASP.NET Core project, I wanted to improve the efficiency of client-server interactions by ensuring that only valid requests were made. This is something HTMX supports by default when you use HTML5 validators on forms and input fields.
Using HTML Range Inputs with ASP.NET Core TagHelpers
By Tan Lee Published on Feb 27, 2025 282
HTML offers a variety of input fields that can significantly enhance user experiences. As of this writing, there are 22 HTML input types, and the InputTagHelper in ASP.NET Core supports 14 of them, based on .NET common language runtime types in your models.
Using HTML DataList with ASP.NET Core
By Tan Lee Published on Feb 27, 2025 525
In this post, I'll explain what a datalist is and why it might be beneficial to use in your ASP.NET Core applications, then we'll implement tag helpers to make the integration of the datalist element easier for your ASP.NET Core MVC and Razor Page applications.
Action and Func Delegates in C#
By Tan Lee Published on Feb 27, 2025 184
Delegates in C# are a powerful feature found in the System.Delegate namespace. They serve various purposes, but the most common ones are:
Override Function in C#
By Tan Lee Published on Feb 27, 2025 245
In C#, the override keyword is used to modify or extend the functionality of a method that is defined in a base class. This mechanism allows derived classes to implement their own version of a method, while preserving the base class's interface.
How to Convert a DataTable to a List of Objects in C#
By Tan Lee Published on Feb 27, 2025 700
To easily convert a DataTable to a list of objects in C#, we can create a generic method that utilizes the power of JSON serialization and deserialization.
What does 'use strict;' means in Javascript
By Tan Lee Published on Feb 27, 2025 282
"Use strict;" is a directive in JavaScript that enforces stricter parsing and error handling on the code. When you apply strict mode, the interpreter enforces stricter rules, catching common coding mistakes and preventing certain problematic or error-prone syntax.
How to detect if caps lock is pressed in Javascript
By Tan Lee Published on Feb 27, 2025 238
Unfortunately, JavaScript doesn't have a direct way to detect if the Caps Lock key itself is pressed
How to create a Custom Event in Javascript
By Tan Lee Published on Feb 27, 2025 259
Creating a custom event in JavaScript involves two main steps: defining the event and dispatching it. The CustomEvent API is used to create custom events that can be listened to and responded to in the same way as built-in events.
How to Check if an Object Has a Property Properly in JavaScript
By Tan Lee Published on Feb 27, 2025 235
When working with objects in JavaScript, it's common to check if a property exists before attempting to use it.
How to convert an Uint8Array to string in Javascript
By Tan Lee Published on Feb 27, 2025 326
To convert a Uint8Array to a string in JavaScript, you can use several methods depending on the environment (e.g., browser or Node.js) and the size of the data.