Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ASP.NET Core updates in .NET 5 Preview 6

#1
ASP.NET Core updates in .NET 5 Preview 6

Avatar

Sourabh

.NET 5 Preview 6 is now available and is ready for evaluation. Here’s what’s new in this release:

  • Blazor WebAssembly template now included
  • JSON extension methods for HttpRequest and HttpResponse
  • Extension method to allow anonymous access to an endpoint
  • Custom handling of authorization failures
  • SignalR Hub filters

Get started


To get started with ASP.NET Core in .NET 5.0 Preview 6 install the .NET 5.0 SDK.

You need to use Visual Studio 2019 16.7 or Visual Studio 2019 for Mac 8.6 to use .NET 5.0. Install the latest version of the C# extension, to use .NET 5.0 with Visual Studio Code.

Upgrade an existing project


To upgrade an existing ASP.NET Core 5.0 Preview 5 app to ASP.NET Core 5.0 Preview 6:

  • Update all Microsoft.AspNetCore.* package references to 5.0.0-preview.6.*.
  • Update all Microsoft.Extensions.* package references to 5.0.0-preview.6.*.

See the full list of breaking changes in ASP.NET Core 5.0.

That’s it! You should now be all set to use .NET 5 Preview 6.

What’s new?


Blazor WebAssembly template now included


The Blazor WebAssembly template is now included in the .NET 5 SDK along with the Blazor Server template. To create a Blazor WebAssembly project, simply run dotnet new blazorwasm.

JSON extension methods for HttpRequest and HttpResponse


You can now easily read and write JSON data from an HttpRequest and HttpResponse using the new ReadFromJsonAsync and WriteAsJsonAsync extension methods. These extension methods use the System.Text.Json serializer to handle the JSON data. You can also check if a request has a JSON content type using the new HasJsonContentType extension method.

The JSON extension methods can be combined with endpoint routing to create JSON APIs in a style of programming we call “route to code”. It is a new option for developers who want to create basic JSON APIs in a lightweight way. For example, a web app that has only a handful of endpoints might choose to use route to code rather than the full functionality of ASP.NET Core MVC.

endpoints.MapGet("/weather/{city:alpha}", async context =>
{ var city = (string)context.Request.RouteValues["city"]; var weather = GetFromDatabase(city); await context.Response.WriteAsJsonAsync(weather);
});

Find out more about the JSON extension methods in a recent On .NET interview about route to code.

Extension method to allow anonymous access to an endpoint


You can now allow anonymous access to an endpoint using the simpler AllowAnonymous extension method when using endpoint routing.

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.UseEndpoints(endpoints => { endpoints.MapGet("/", async context => { await context.Response.WriteAsync("Hello World!"); }) .AllowAnonymous(); });
}

Custom handling of authorization failures


Custom handling of authorization failures is now easier with the new IAuthorizationMiddlewareResultHandler interface that is invoked by the AuthorizationMiddleware. The default implementation remains the same, but a custom handler can be be registered in DI which allows things like custom HTTP responses based on why authorization failed. A sample that demonstrates usage of the IAuthorizationMiddlewareResultHandler can be found here.

SignalR Hub filters


Hub filters, called Hub pipelines in ASP.NET SignalR, is a feature that allows you to run code before and after Hub methods are called, similar to how middleware lets you run code before and after an HTTP request. Common uses include logging, error handling, and argument validation.

You can read more about this Hub filters on the docs page.

Give feedback


We hope you enjoy this release of ASP.NET Core in .NET 5! We are eager to hear about your experiences with this latest .NET 5 release. Let us know what you think by filing issues on GitHub.

Thanks for trying out ASP.NET Core!



https://www.sickgaming.net/blog/2020/06/...preview-6/
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  ASP.NET Core updates in .NET 5 Release Candidate 2 xSicKxBot 0 12 10-14-2020, 05:15 PM
Last Post: xSicKxBot
  ASP.NET Core updates in .NET 5 Release Candidate 1 xSicKxBot 0 37 09-16-2020, 06:05 PM
Last Post: xSicKxBot
  ASP.NET Core updates in .NET 5 Preview 8 xSicKxBot 0 51 09-11-2020, 05:43 AM
Last Post: xSicKxBot
  ASP.NET Core Updates in .NET 5 Preview 7 xSicKxBot 0 47 09-10-2020, 03:56 PM
Last Post: xSicKxBot
  Orchard Core Release Candidate 2 now available xSicKxBot 0 53 09-10-2020, 02:35 AM
Last Post: xSicKxBot
  Introducing “Web Live Preview” xSicKxBot 0 49 09-09-2020, 03:48 AM
Last Post: xSicKxBot
  ASP.NET Core updates in .NET 5 Preview 5 xSicKxBot 0 44 09-08-2020, 09:30 PM
Last Post: xSicKxBot
  ASP.NET Core updates in .NET 5 Preview 8 xSicKxBot 0 53 08-27-2020, 09:44 AM
Last Post: xSicKxBot
  ASP.NET Core Updates in .NET 5 Preview 7 xSicKxBot 0 118 07-22-2020, 05:49 AM
Last Post: xSicKxBot
  ASP.NET Core updates in .NET 5 Preview 6 xSicKxBot 0 129 06-28-2020, 09:35 AM
Last Post: xSicKxBot

Forum Jump:

Become a Patron!
[-]
Upcoming Events

[-]
Latest Threads
Unity Mega Bundle X 10th Anniversary Sal...
Last Post: xSicKxBot
Today 01:02 AM
» Replies: 0
» Views: 0
Microsoft - Fundraising and Engagement f...
Last Post: xSicKxBot
Today 01:02 AM
» Replies: 0
» Views: 0
Fedora - Incremental backup with Butterf...
Last Post: xSicKxBot
Today 01:01 AM
» Replies: 0
» Views: 0
News - Review: Horace – A Heart-Warming ...
Last Post: xSicKxBot
Yesterday 11:38 PM
» Replies: 0
» Views: 0
News - Matthew McConaughey Explains The ...
Last Post: xSicKxBot
Yesterday 10:20 PM
» Replies: 0
» Views: 1
PlanetSide 2 External Hack / Mod
Last Post: FarCry10
Yesterday 05:27 PM
» Replies: 6
» Views: 6812
(Indie Deal) FREE Defense of Roman Brita...
Last Post: xSicKxBot
Yesterday 03:53 PM
» Replies: 0
» Views: 3
AppleInsider - Lowest iPad Pro prices: s...
Last Post: xSicKxBot
Yesterday 03:19 PM
» Replies: 0
» Views: 3
Microsoft - CVP Tom McGuinness: Top take...
Last Post: xSicKxBot
Yesterday 03:19 PM
» Replies: 0
» Views: 3
News - Nintendo First Revealed The Switc...
Last Post: xSicKxBot
Yesterday 03:19 PM
» Replies: 0
» Views: 3

[-]
Twitter

[-]
Sponsored
Get the Deal of the Week at RefurBees.com

Copyright © SickGaming.net 2012-2020