How To

Logging requests and responses in ASP.NET Core
2/4/2025 8:44:37 AM  102

In ASP.NET Core, logging HTTP requests and responses is a crucial aspect of monitoring and debugging applications.

How to manually validate a model in a controller in ASP.NET Core
2/4/2025 8:39:49 AM  148

Validating a model manually in ASP.NET Core can be approached in different ways, depending on your needs. You may want to validate a model object using its validation attributes, or you might need to apply custom validation logic.

How to disable ModelStateInvalidFilter in ASP.NET Core
2/4/2025 8:34:14 AM  133

In ASP.NET Core, ModelStateInvalidFilter is a built-in filter that automatically returns a 400 Bad Request response when the ModelState is invalid.

How to add custom middleware in ASP.NET Core
2/4/2025 8:29:12 AM  134

In ASP.NET Core, the request pipeline is a series of middleware components that handle HTTP requests.

How to Turn Off Startup Logging in ASP.NET Core
2/4/2025 8:24:29 AM  71

When you launch an ASP.NET Core web application, you might notice several startup log messages in the console.

Dependency inject BackgroundService into controllers
2/4/2025 8:21:18 AM  52

To inject a BackgroundService into controllers in ASP.NET Core, you can't directly inject it through constructor injection like a normal service.

How to Configure JSON Serializer options in ASP.NET Core
2/4/2025 8:14:34 AM  192

ASP.NET Core uses System.Text.Json as the default JSON serializer. To customize the JSON serializer options globally, you can use the AddJsonOptions() method in the initialization code.

C# Async/Await with a Func delegate
2/4/2025 8:03:19 AM  152

To make a Func delegate awaitable, you need to return a Task from the delegate.

How to use Dictionary with tuples in C#
2/4/2025 8:01:39 AM  233

You can use dictionaries with tuples as either keys or values in C#.

How to Get all loaded assemblies in C#
2/4/2025 7:08:22 AM  101

In C#, you can get all loaded assemblies by using the AppDomain.CurrentDomain.GetAssemblies() method.

How to Get all classes that implement interface in C#
2/4/2025 6:49:28 AM  100

You can use reflection to retrieve all classes in the current assembly that implement a specific interface.

How to Use Convert.ChangeType to convert string to any type in C#
2/4/2025 6:42:24 AM  193

You can utilize Convert.ChangeType() to transform a string into any type, like this: