Skip to main content

Posts

Showing posts with the label Part 1️⃣ - Common Shared Library |๐Ÿ›’ Build .NET 8 eCommerce Microservice ๐Ÿš€with API Gateway

๐Ÿš€Master User Authentication in .NET 8 Web API Email Confirmation, Password Reset, 2FA & Lockout with JWT & Identity๐Ÿ”

Part 1️⃣ - Common Shared Library |๐Ÿ›’ Build .NET 8 eCommerce Microservice ๐Ÿš€with API Gateway, Rate Limiting, Caching & more ๐Ÿงบ

RESPONSE This code defines a C# record named Response with two properties: Flag , a boolean initialized to false , and Message , a string that defaults to null . Records in C# are immutable reference types that provide built-in functionality for value equality and concise syntax for defining data containers. GLOBAL EXCEPTION This code defines a middleware class named GlobalException for handling exceptions and specific HTTP response statuses in an ASP.NET Core application. The middleware checks for and modifies responses with status codes 401 (Unauthorized), 403 (Forbidden), and 429 (Too Many Requests). It also handles internal server errors and request timeouts by logging the exceptions and sending user-friendly error messages in JSON format. Key components of this middleware include: Dependencies : Uses Microsoft.AspNetCore.Http , Microsoft.AspNetCore.Mvc , System.Net , and System.Text.Json . Constructor : Takes a RequestDele