Custom routing constraint in AspNet core

Introduction URL routing is a fundamental part of ASP.NET Core applications, determining how incoming requests are mapped to controller actions. While the framework provides numerous built-in route constraints like int, bool, and guid, there are situations where you need more sophisticated validation rules for your URL parameters. This is where custom route constraints become invaluable. In this guide, we’ll explore how to create and implement custom route constraints in ASP.NET Core using the IRouteConstraint interface. By the end, you’ll understand how to validate URL parameters with complex business rules specific to your application. ...

June 20, 2025 · 7 min · 1303 words

How to prevent attacks in AspNet.Core application?

ASP.NET Core is a modern web development framework that provides a variety of built-in security features to help prevent attacks on web application. Here are a few ways we can use ASP.NET Core to prevent attacks: Introduction In today’s threat landscape, web application security is no longer optional, it’s essential. ASP.NET Core provides a robust security framework with built-in features to defend against common attack vectors. This guide explores practical implementations of these security measures to protect your applications effectively. ...

June 20, 2025 · 7 min · 1395 words

Routing in ASP.NET Core: A Comprehensive Guide

Introduction to ASP.NET Core Routing At its core, routing in ASP.NET Core is just about connecting HTTP requests to the right code in your application. Good routing gives you clean, readable URLs that make sense to both users and search engines. Since ASP.NET Core 3.0, we’ve been using something called Endpoint Routing, which has gotten better with each new version. It works the same way across all parts of your app, whether you’re using MVC controllers, Razor Pages, or the newer minimal APIs. ...

June 20, 2025 · 8 min · 1680 words