Is it possible to await on tasks in Razor .cshtml views?
await
By default it complains that it can only be used in methods marked with async so I'm wondering if maybe there is a hidden switch somewhere that enables it?
async
In ASP.NET Core 2.1, you can use await in Razor views.
See https://docs.microsoft.com/en-us/aspnet/core/mvc/views/partial?view=aspnetcore-2.1
Example:
@await Html.PartialAsync("../Account/_LoginPartial.cshtml")
1.4m articles
1.4m replys
5 comments
57.0k users