Use of await in Razor views

前端 未结 8 882
面向向阳花
面向向阳花 2020-11-28 12:48

Is it possible to await on tasks in Razor .cshtml views?

By default it complains that it can only be used in methods marked with async so I

8条回答
  •  执笔经年
    2020-11-28 13:09

    No, that's not possible and you shouldn't need to do it anyway. Razor views should contain markup and at most some helper call. async/await belongs to your backend logic.

提交回复
热议问题