mvcsitemapprovider

Is it possible to get template from different directory?

送分小仙女□ 提交于 2021-02-11 15:15:51
问题 I'm using the same cshtml files in different projects so I would like to be able to share the same directory, the 'GeneralTemplates'. So using the @Html.Partial("GeneralTemplates/_Header") works like a charm. But with @Html.MvcSiteMap().SiteMapPath("GeneralTemplates/_Breadcrumbs") is doesn't work, this needs to be in the 'DisplayTemplates' directory and then this works @Html.MvcSiteMap().SiteMapPath("_Breadcrumbs") . Does anyone has an solution for me to be able to have the file in the

How to register custom ISiteMapNodeUrlResolver in MvcSiteMapProviderRegistry

假装没事ソ 提交于 2020-01-15 11:22:33
问题 For the MvcSiteMapProvider v4, I've written a custom sitemap url resolver by overriding SiteMapNodeUrlResolverBase. But I don't know how to register it in the MvcSiteMapProviderRegistry to make sure that a node's Url is always resolved using my own SiteMapNodeUrlResolver. I expected something like: this.For<ISiteMapNodeUrlResolver>().Use<MyUrlResolver>(); But this doesn't work, how should I do this? 回答1: The SiteMapNodeUrlResolvers (along with visibility providers and dynamic node providers)

MvcSiteMapProvider Menu with Filter Attributes in the Controller Class in Asp.Net Mvc 5

守給你的承諾、 提交于 2020-01-15 11:22:08
问题 I am using this lib: https://github.com/maartenba/MvcSiteMapProvider I want to have a menu structure like this: <ul> <li><a href="/">Home</a></li> <li> <a href="#">Stuff</a> <ul> <li><a href="/Stuff/"<li> <li><a href="/Stuff/Add"<li> </ul> </li> </ul> I am using MvcSiteMapNode without xml; just with the decorator's way. So I have this Controller: [MvcSiteMapNode(Title = "Stuff", ParentKey = "root", Key = "stuff-key", Url = "#", ImageUrl = "fa-stuff")] public class StuffController : Controller

MvcSiteMapProvider Menu with Filter Attributes in the Controller Class in Asp.Net Mvc 5

白昼怎懂夜的黑 提交于 2020-01-15 11:21:47
问题 I am using this lib: https://github.com/maartenba/MvcSiteMapProvider I want to have a menu structure like this: <ul> <li><a href="/">Home</a></li> <li> <a href="#">Stuff</a> <ul> <li><a href="/Stuff/"<li> <li><a href="/Stuff/Add"<li> </ul> </li> </ul> I am using MvcSiteMapNode without xml; just with the decorator's way. So I have this Controller: [MvcSiteMapNode(Title = "Stuff", ParentKey = "root", Key = "stuff-key", Url = "#", ImageUrl = "fa-stuff")] public class StuffController : Controller

How to register custom ISiteMapNodeUrlResolver in MvcSiteMapProviderRegistry

一世执手 提交于 2020-01-15 11:18:10
问题 For the MvcSiteMapProvider v4, I've written a custom sitemap url resolver by overriding SiteMapNodeUrlResolverBase. But I don't know how to register it in the MvcSiteMapProviderRegistry to make sure that a node's Url is always resolved using my own SiteMapNodeUrlResolver. I expected something like: this.For<ISiteMapNodeUrlResolver>().Use<MyUrlResolver>(); But this doesn't work, how should I do this? 回答1: The SiteMapNodeUrlResolvers (along with visibility providers and dynamic node providers)

How to create grouping and clickable nodes from single action simultaneously?

£可爱£侵袭症+ 提交于 2020-01-06 14:07:51
问题 I have controller Account and its method LogOn. How to create sitemap like this: -Account // non clickable, just grouping --Log On // clickable ? If I use site map in the form of XML-file (mvc.sitemap) I can write like this: <mvcSiteMapNode title="Account" controller="Account" action="LogOn" clickable="false" key="AccountGroup" > <mvcSiteMapNode title="Log On" controller="Account" action="LogOn" key="LogOn" /> </mvcSiteMapNode> But I want to do it with only MvcSiteMapNodeAttribute attribute.

How to create grouping and clickable nodes from single action simultaneously?

纵然是瞬间 提交于 2020-01-06 14:07:32
问题 I have controller Account and its method LogOn. How to create sitemap like this: -Account // non clickable, just grouping --Log On // clickable ? If I use site map in the form of XML-file (mvc.sitemap) I can write like this: <mvcSiteMapNode title="Account" controller="Account" action="LogOn" clickable="false" key="AccountGroup" > <mvcSiteMapNode title="Log On" controller="Account" action="LogOn" key="LogOn" /> </mvcSiteMapNode> But I want to do it with only MvcSiteMapNodeAttribute attribute.

MVCSiteMap Node Requring Multiple Roles

試著忘記壹切 提交于 2020-01-06 05:10:55
问题 I've set up my menu using MVCSiteMap and I have this node: <mvcSiteMapNode title="Courses Form" controller="Booking" action="Course" roles="CORLIC, VIEWCOBO"/> I'm trying to enforce that this node must have roles "CORLIC" AND "VIEWCOBO" for it to be visible but of course this means that it will be displayed if the user has either of the above. Is this possible? Thanks. 回答1: The roles attribute is for interoperability with ASP.NET and should not be used in an MVC-only application. For MVC, if

MVC SiteMap Provider Security Trimming + Cache

僤鯓⒐⒋嵵緔 提交于 2020-01-05 12:16:37
问题 I have setup MVC SiteMap Provider in an ASP.NET MVC project to render a Dropdown Menu. I configured it to use Security Trimming <add key="MvcSiteMapProvider_SecurityTrimmingEnabled" value="true"/> It works as expected, i.e., does not show nodes in the menu to which the user does not have access to. However, I am debugging the application and I can see that with each page reload, the breakpoint in the AuthorizeAttribute is being hit X+1 times, where X is the number of nodes that are rendered

MVC SiteMap Provider Security Trimming + Cache

空扰寡人 提交于 2020-01-05 12:16:08
问题 I have setup MVC SiteMap Provider in an ASP.NET MVC project to render a Dropdown Menu. I configured it to use Security Trimming <add key="MvcSiteMapProvider_SecurityTrimmingEnabled" value="true"/> It works as expected, i.e., does not show nodes in the menu to which the user does not have access to. However, I am debugging the application and I can see that with each page reload, the breakpoint in the AuthorizeAttribute is being hit X+1 times, where X is the number of nodes that are rendered