The latest iteration of .NET, Preview 7 of version 8, has ushered in a wave of significant advancements and alterations for ASP.NET Core. Noteworthy among the many enhancements in this rendition of ASP.NET Core are those relating to Blazor, Native AOT, Identity, fresh SPA Visual Studio templates, the augmentation of Antiforgery middleware, and an array of additional improvements.

Delving into the Blazor realm, there’s a pivotal shift where endpoints are now mandated to incorporate antiforgery protection by default. According to reports, the EditForm component will, henceforth, autonomously append the antiforgery token. It’s worth noting that this function can be deactivated, though it’s not advisable to do so. The development landscape has also witnessed a change, as now developers can create standard HTML forms in server-side rendering mode without being tethered to the EditForm component.

The Blazor landscape introduces a medley of other substantial upgrades, most notably the introduction of Auto interactive render mode. This innovative mode seamlessly blends the Server and WebAssembly render modes, optimizing rendering performance by leveraging WebAssembly when the .NET runtime loads expeditiously, typically within the 100ms mark. Further enhancements include the extension of root-level cascading values, making them accessible across the component hierarchy.

Another facet of this evolution is the ability to fluidly append, remove, and parameterize interactive components. Enhanced navigation, fortified form handling, and streamlining rendering have made this aspect more robust than ever. The newly introduced Virtualize component boasts the EmptyContent property, a concise means to define content scenarios where items are absent, or when the ItemsProvider yields a count of zero for TotalItemCount.

Turning our attention to APIs, a fresh middleware now exists for the validation of antiforgery tokens. This mechanism stands as a crucial defense against cross-site request forgery attacks. Activation of this middleware occurs upon registering antiforgery services through the AddAntiforgery method. Ensuring that the antiforgery middleware follows authentication and authorization middleware is of paramount importance in preventing unauthorized access to form data. Furthermore, antiforgery token validation will now be a requisite for Minimal API handling form data.

Native AOT capabilities have also taken a significant leap forward with Preview 7. Developers can reap the benefits of an upgraded Request Delegate Generator, capable of accommodating new C# 12 interceptors and compiler features. This empowers the interception of minimal API calls within Map action methods. The results of these changes are detailed in an accompanying blog post, making it highly recommended reading material. Furthermore, a fresh addition in the form of the WebApplication.CreateEmptyBuilder factory method has emerged, promising leaner apps that encompass only essential features.

In closing, the .NET 8 Preview 7 ushers in an era of substantial progress for ASP.NET Core. The Blazor enhancements, Native AOT developments, fortified security measures, and various refinements collectively signify a significant stride forward for the platform

Source: https://devblogs.microsoft.com/dotnet/asp-net-core-updates-in-dotnet-8-preview-7