Solution Review: Restrict Access to Content
Review the solution where we restrict access to certain content in Blazor to only authenticated users.
We'll cover the following
To restrict access to the content inside the Index.razor
file, we applied the AuthorizeView
element on lines 5–13. We wrapped the original content inside the Authorized
element on lines 6–9. We also added the NotAuthorized
element on lines 10–12 with a single p
HTML element and Nothing to see here.
as text.
Solution
The code widget below shows the complete solution to the exercise.
Get hands-on with 1400+ tech skills courses.