Skip to content

Commit 00ebfb4

Browse files
SteveSandersonMSmkArtakMSFT
authored andcommitted
When using auth, use CascadingAuthenticationState explicitly. Fixes #14566
1 parent ebe81c2 commit 00ebfb4

File tree

1 file changed

+16
-13
lines changed
  • src/ProjectTemplates/Web.ProjectTemplates/content/BlazorServerWeb-CSharp

1 file changed

+16
-13
lines changed
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
<Router AppAssembly="@typeof(Program).Assembly">
1+
@*#if (NoAuth)
2+
<Router AppAssembly="@typeof(Program).Assembly">
23
<Found Context="routeData">
3-
@*#if (!NoAuth)
4-
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
5-
#else
64
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
7-
#endif*@
85
</Found>
96
<NotFound>
10-
@*#if (!NoAuth)
11-
<CascadingAuthenticationState>
12-
<LayoutView Layout="@typeof(MainLayout)">
13-
<p>Sorry, there's nothing at this address.</p>
14-
</LayoutView>
15-
</CascadingAuthenticationState>
16-
#else
177
<LayoutView Layout="@typeof(MainLayout)">
188
<p>Sorry, there's nothing at this address.</p>
199
</LayoutView>
20-
#endif*@
2110
</NotFound>
2211
</Router>
12+
#else
13+
<CascadingAuthenticationState>
14+
<Router AppAssembly="@typeof(Program).Assembly">
15+
<Found Context="routeData">
16+
<AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
17+
</Found>
18+
<NotFound>
19+
<LayoutView Layout="@typeof(MainLayout)">
20+
<p>Sorry, there's nothing at this address.</p>
21+
</LayoutView>
22+
</NotFound>
23+
</Router>
24+
</CascadingAuthenticationState>
25+
#endif*@

0 commit comments

Comments
 (0)