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
318 Points
16 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: 1576
Total Answered: 3
Total Marked As Answer: 1
Posted On: 03-Jan-2024 05:22

Share:   fb twitter linkedin
Answers
ykl
ykl
318 Points
16 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
1068 Points
19 Posts
         

great!

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

Having similar issue, resolved by adding following:

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