File tree Expand file tree Collapse file tree
aspnetcore/includes/blazor-security Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,7 +11,17 @@ The `App` component (*App.razor*) is similar to the `App` component found in Bla
1111 <AuthorizeRouteView RouteData="@routeData"
1212 DefaultLayout="@typeof(MainLayout)">
1313 <NotAuthorized>
14- <RedirectToLogin />
14+ @if (!context.User.Identity.IsAuthenticated)
15+ {
16+ <RedirectToLogin />
17+ }
18+ else
19+ {
20+ <p>
21+ You are not authorized to access
22+ this resource.
23+ </p>
24+ }
1525 </NotAuthorized>
1626 </AuthorizeRouteView>
1727 </Found>
Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ The `RedirectToLogin` component (*Shared/RedirectToLogin.razor*):
99@code {
1010 protected override void OnInitialized()
1111 {
12- Navigation.NavigateTo($"authentication/login?returnUrl={Navigation.Uri}");
12+ Navigation.NavigateTo(
13+ $"authentication/login?returnUrl={Uri.EscapeDataString(Navigation.Uri)}");
1314 }
1415}
1516```
You can’t perform that action at this time.
0 commit comments