开发者

ASP.NET MVC SiteMap samples

I just did downloaded it from codeplex http://mvcsitemap.codeplex.com/ and can’t make it work properly, there is no so good samples around.

I need to display sitemap sections depending on action. Should i define multiple sitemaps, in such case the question is how to pass this paths to SiteMap control dynamically

File 1:

<siteMap>
  <siteMapNode>
    <siteMapNode title="Public Pages">
      <siteMapNode title="Page 1">
        <siteMapNode title="Page 1" action="Page1" controller="PublicPages"/>
        <siteMapNode title="Page 2" action="Page2" controller="PublicPages"/>
        <siteMapNode title="Page 3" action="Page3" controller="PublicPages"/>
      </siteMapNode>
     </siteMapNode>
   </siteMapNode>
</siteMap>

File 2:

<siteMap>
  <siteMapNode>
   <siteMapNode title="Home">
      <siteMapNode action="Index" controller="Home" title="Home" description="Home Page" />
      <siteMapNode action="About" controller="Home" title="About" description="About Page" />
   </siteMapNode>
   <siteMapNode title="Account" description="Account Information" roles="User">
   <siteMapNode action="ChangePassword" controller="Account" title="Change Password" description="Change Password" />
  </siteMapNode>    
</siteMap>

Otherwise should i have only one sitemap file and different sections within, in that case the question is how to say to control to display particular sections of the site map?

<siteMap>
  <siteMapNode>
<siteMapNode title="Public Pages">
  <siteMapNode title="Page 1">
    <siteMapNode title="Page 1" action="Page1" controller="PublicPages"/>
    <siteMapNode title="Page 2" action="Page2" controller="PublicPages"/>
    <siteMapNode title="Page 3" action="Page3" controller="PublicPages"/>
  </siteMapNode>
</siteMapNode>
<siteMapNode title="Home">
  <siteMapNode action="Ind开发者_Python百科ex" controller="Home" title="Home" description="Home Page" />
  <siteMapNode action="About" controller="Home" title="About" description="About Page" />
</siteMapNode>
<siteMapNode title="Account" description="Account Information" roles="User">
  <siteMapNode action="ChangePassword" controller="Account" title="Change Password" description="Change Password" />
  </siteMapNode>    
</siteMap>

May be someone may provide any samples for this case?


ASP.NET MVC Simple Sitemap This will produce valid sitemap for your ASP.NET MVC application, it is really simple to use so it may not suit bigger application needs. There is example usage too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜