What's New In .NET 5 Preview 6

Microsoft released .NET 5 Preview 6 featuring Blazor WebAssembly template, JSON extension methods, Extension method to allow anonymous access to an endpoint, Custom handling of authorization failures, and SignalR Hub filters.
 
With Preview 6, the Blazor WebAssembly template is now included in the .NET 5 SDK along with the Blazor Server template. In order to create a Blazor WebAssembly project, you will simply need to run dotnet new blazorwasm.
 
 
The release also features JSON extension methods for HttpRequest and HttpResponse. Developers can now read and write JSON data from an HttpRequest and HttpResponse using the new ReadFromJsonAsync and WriteAsJsonAsync extension methods. These methods make use of the System.Text.Json serializer to handle the JSON data. Developers can also check if a request has a JSON content type using the new HasJsonContentType extension method.
 
Microsoft said that you can now allow anonymous access to an endpoint using the easier AllowAnonymous extension method when using endpoint routing. And custom handling of authorization failures is now more comfortable with the new IAuthorizationMiddlewareResultHandler interface that is invoked by the AuthorizationMiddleware.
 
The release also brings Hub filters, dubbed Hub pipelines in ASP.NET SignalR, which is a feature that enables developers to run code before and after Hub methods are called. This is similar to the way middleware enables you run code before and after an HTTP request. Common uses of Hub filters include logging, error handling, and argument validation.