Code snippet illustrating data transfer between controllers using TempData

TempData in ASP.NET Core: Transferring Data Between Controllers

TempData - Transfer data between controllers Ideal for transferring small amounts of data between controllers in ASP.NET MVC. Unlike ViewData and ViewBag, which are specific to a single view, TempData persists for one request cycle. This means the data remains available until it鈥檚 accessed, at which point it鈥檚 automatically removed. 馃憠 Adapted from my original post on LinkedIn .

August 15, 2024 路 1 min 路 59 words 路 Eduardo Potumati
Code snippet illustrating the UseRewriter middleware in ASP.NET Core

Handling Duplicate URLs in ASP.NET MVC: www vs non-www

Concerned about duplicate URLs in ASP.NET MVC? Take care of both www and non-www domains. .NET already provides the correct method to handle them. Using the UseRewriter middleware is the optimal approach. You can use AddRedirectToNonWww() or AddRedirectToWww() for this purpose. 馃憠 Adapted from my original post on LinkedIn .

July 15, 2024 路 1 min 路 50 words 路 Eduardo Potumati
Code example illustrating Regex route constraints in ASP.NET Core MVC

Using Regular Expressions for ASP.NET MVC Routing

Using Regular Expressions (Regex) is a highly effective method for segmenting your ASP.NET MVC routing. With Regex route constraints, developers can create intricate matching patterns, leading to much more flexible and dynamic routing configurations directly in their controllers. Important: Always exercise caution when using System.Text.RegularExpressions to process untrusted input, as poorly constructed patterns can be vulnerable to Regular Expression Denial of Service (ReDoS) attacks. 馃憠 Adapted from my original post on LinkedIn . ...

April 15, 2024 路 1 min 路 73 words 路 Eduardo Potumati