【问题标题】:How to hide node with ASP.NET MVC SiteMap provider如何使用 ASP.NET MVC SiteMap 提供程序隐藏节点
【发布时间】:2011-09-19 08:20:21
【问题描述】:

我有这样的节点,当用户通过身份验证时我想隐藏它。

如何使用 ASP.NET MVC SiteMap 提供程序来做到这一点?

我试过了:

http://mvcsitemap.codeplex.com/discussions/246986

然后我得到一个错误:

Value cannot be null.
Parameter name: type 
 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: type

Source Error: 

Line 114:               @Html.MvcSiteMap("MvcSiteMapProvider").Menu()

【问题讨论】:

  • 在节点中设置可见性提供程序时,请记住还要指定程序集名称:visibilityProvider="MyProject.VisibilityProviders.MyVisibilityProvider, MyProject"

标签: asp.net-mvc-3 mvcsitemapprovider


【解决方案1】:

您可以通过指定 roles="?" 使您的节点对经过身份验证的用户隐藏在您的节点中:

<mvcSiteMapNode controller="HomeController" action="Index" title="Home" roles="?"/>

【讨论】:

    猜你喜欢
    • 2023-03-23
    • 1970-01-01
    • 2014-09-22
    • 2014-11-19
    • 2011-08-21
    • 2013-02-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多