InvalidOperationException: Endpoint / (/) contains anti-forgery metadata, but a middleware was not found that supports anti-forgery. Configure your application startup by adding app.UseAntiforgery() in the application startup code.

ykl
ykl
Member
116 Points
5 Posts

Getting following error - Migrating blazor server to .net 8 with blazor app:

InvalidOperationException: Endpoint / (/) contains anti-forgery metadata, but a middleware was not found that supports anti-forgery. Configure your application startup by adding app.UseAntiforgery() in the application startup code.
Views: 570
Total Answered: 3
Total Marked As Answer: 1
Posted On: 03-Jan-2024 05:22

Share:   fb twitter linkedin
Answers
ykl
ykl
Member
116 Points
5 Posts
         

It was resolved by adding following middleware in startup.cs

app.UseAntiforgery()
Posted On: 03-Jan-2024 09:51
Thanks for sharing solution.
 - Brian  03-Jan-2024 09:52
Rashmi
Rashmi
Member
820 Points
17 Posts
         

great!

Posted On: 17-Apr-2024 03:38
mongo
mongo
Participant
84 Points
8 Posts
         

Having similar issue, resolved by adding following:

app.UseAntiforgery()
Posted On: 18-Apr-2024 23:25
 Log In to Chat