サンプル
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Antiforgery
@{
var requestToken = Antiforgery.GetAndStoreTokens(Context).RequestToken;
}
<input id="RequestVerificationToken" type="hidden" value="@requestToken" />
参考
https://docs.microsoft.com/ja-jp/aspnet/core/security/anti-request-forgery?view=aspnetcore-6.0