如何使用 ASP.NET MVC SiteMap 提供程序隐藏节点
我有这样的节点,我想在用户通过身份验证时隐藏它。
我如何使用 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()
I have such node which i want to hide when user is authenticated.
How can i do that with ASP.NET MVC SiteMap provider?
I tried that:
http://mvcsitemap.codeplex.com/discussions/246986
but then i am getting an error:
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()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以通过指定 Roles="?" 来对经过身份验证的用户隐藏节点。在您的节点中:
You can make your node hidden for authenticated users by specifying roles="?" in your node:
<mvcSiteMapNode controller="HomeController" action="Index" title="Home" roles="?"/>