为什么在app.razor中无法识别NotAuthorizedContent标记

lichess4

我正在使用app.razor中的标记来指示所有页面中未授权用户显示同一消息的页面,但NotAuthorizedContent标记无法识别我

<CascadingAuthenticationState>
<Router AppAssembly="@typeof(Program).Assembly">
    <Found Context="routeData">
        <RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
    </Found>

    <NotFound>
        <LayoutView Layout="@typeof(MainLayout)">
            <p>Sorry, there's nothing at this address.</p>
        </LayoutView>
    </NotFound>
    <NotAuthorizedContent>
        <h1>Sorry</h1>
        <p>You're not authorized to reach this page. You may need to log in as a different user.</p>
    </NotAuthorizedContent>
</Router>
布莱恩·帕克

用途AuthorizeRouteView

<CascadingAuthenticationState>
    <Router AppAssembly="@typeof(Program).Assembly">
        <Found Context="routeData">
            <AuthorizeRouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)">                
                <NotAuthorized>
                    @if (!context.User.Identity.IsAuthenticated)
                    {
                        <RedirectToLogin />
                    }
                    else
                    {
                        <p>@L["NotAuthorized"]</p>
                    }
                </NotAuthorized>
                
            </AuthorizeRouteView>
        </Found>
        <NotFound>
            <LayoutView Layout="@typeof(MainLayout)">
                <p>@L["NothingAtAddress"]</p>
            </LayoutView>
        </NotFound>
    </Router>
</CascadingAuthenticationState>

注意:我在这里使用本地化服务来显示文本。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

为什么我的App测试无法被Django测试识别?

来自分类Dev

为什么我的React App无法编译?

来自分类Dev

为什么concat在Teradata中无法识别?

来自分类Dev

为什么在WebForms中无法识别ruleSet?

来自分类Dev

为什么在scala中无法识别proc?

来自分类Dev

为什么无法识别“ \ xff”?

来自分类Dev

为什么无法识别路线?

来自分类Dev

为什么 google-cloud-sdk go-app-stager 无法识别 GOPATH?

来自分类Dev

为什么无法将iOS App移植到tvOS?

来自分类Dev

为什么我无法验证iOS App存档?

来自分类Dev

为什么CSS无法从App.css文件渲染

来自分类Dev

为什么React无法定义'App'组件?

来自分类Dev

为什么我无法验证iOS App存档?

来自分类Dev

为什么我的ASP .NET MVC 5 Razor View无法识别我的Javascript功能?

来自分类Dev

为什么Python无法识别集合中的元素?

来自分类Dev

模态主体中无法识别JS代码..为什么?

来自分类Dev

Scanset无法识别c中的回车,为什么?

来自分类Dev

为什么我的“ about”标签无法在R中识别

来自分类Dev

为什么Monkeypatch无法在构造函数中识别出赋值?

来自分类Dev

为什么R中的“ xts”无法识别我的日期序列?

来自分类Dev

为什么Python无法识别集合中的元素?

来自分类Dev

为什么在“;”之后无法识别变量 在java中

来自分类Dev

为什么Prolog无法识别查询中的参数?

来自分类Dev

为什么剃刀中的 td 元素无法识别样式?

来自分类Dev

为什么 Dagger 无法识别 AppModule 中的 @Provides?

来自分类Dev

为什么我的Azure App Service Logic App无法使用我的API App?

来自分类Dev

为什么我的Azure App Service Logic App无法使用我的API App?

来自分类Dev

为什么vuex在Quasar App中返回对象而不是数组?

来自分类Dev

为什么{}在Terminal.app中开始显示为äå?

Related 相关文章

  1. 1

    为什么我的App测试无法被Django测试识别?

  2. 2

    为什么我的React App无法编译?

  3. 3

    为什么concat在Teradata中无法识别?

  4. 4

    为什么在WebForms中无法识别ruleSet?

  5. 5

    为什么在scala中无法识别proc?

  6. 6

    为什么无法识别“ \ xff”?

  7. 7

    为什么无法识别路线?

  8. 8

    为什么 google-cloud-sdk go-app-stager 无法识别 GOPATH?

  9. 9

    为什么无法将iOS App移植到tvOS?

  10. 10

    为什么我无法验证iOS App存档?

  11. 11

    为什么CSS无法从App.css文件渲染

  12. 12

    为什么React无法定义'App'组件?

  13. 13

    为什么我无法验证iOS App存档?

  14. 14

    为什么我的ASP .NET MVC 5 Razor View无法识别我的Javascript功能?

  15. 15

    为什么Python无法识别集合中的元素?

  16. 16

    模态主体中无法识别JS代码..为什么?

  17. 17

    Scanset无法识别c中的回车,为什么?

  18. 18

    为什么我的“ about”标签无法在R中识别

  19. 19

    为什么Monkeypatch无法在构造函数中识别出赋值?

  20. 20

    为什么R中的“ xts”无法识别我的日期序列?

  21. 21

    为什么Python无法识别集合中的元素?

  22. 22

    为什么在“;”之后无法识别变量 在java中

  23. 23

    为什么Prolog无法识别查询中的参数?

  24. 24

    为什么剃刀中的 td 元素无法识别样式?

  25. 25

    为什么 Dagger 无法识别 AppModule 中的 @Provides?

  26. 26

    为什么我的Azure App Service Logic App无法使用我的API App?

  27. 27

    为什么我的Azure App Service Logic App无法使用我的API App?

  28. 28

    为什么vuex在Quasar App中返回对象而不是数组?

  29. 29

    为什么{}在Terminal.app中开始显示为äå?

热门标签

归档