Create a sitemap sml based
file and save it with sitemap.config name.
<?xml
version="1.0"
encoding="utf-8"
?>
<siteMap>
<siteMapNode
title="Home"
controller="Home"
action="Overview">
<siteMapNode
title="Dashboard"
nopResource="Admin.Dashboard"
controller="Home"
action="Index"
ImageUrl="~/Administration/Content/images/ico-dashboard.png"
/>
<siteMapNode
title="Catalog"
nopResource="Admin.Catalog"
PermissionNames="ManageCatalog"
ImageUrl="~/Administration/Content/images/ico-catalog.png"
>
<siteMapNode
title="Categories"
nopResource="Admin.Catalog.Categories">
<siteMapNode
title="List"
nopResource="Admin.Common.List"
controller="Category"
action="List"/>
<siteMapNode
title="Tree
view" nopResource="Admin.Common.Treeview"
controller="Category"
action="Tree"/>
</siteMapNode>
</siteMap>
To bind above sitemap on page, please follow the below code.
@using System.Data;
@using System;
<div
class="page-title">
<h2>"Sitemap"</h2>
</div>
@{
string fileName =
System.Web.HttpContext.Current.Server.MapPath("~/sitemap.config");
DataSet
ds = new DataSet();
ds.ReadXml(fileName);
<table>
<tr>
<td
width="20%"></td>
<td
style="border:
2px double #CCCCCC; padding-left:
50px;" width="30%">
@for(int i=1;i<ds.Tables[0].Rows.Count/2;i++)
{
if(ds.Tables[0].Rows[i]["action"].ToString()=="")
{
<h4>@ds.Tables[0].Rows[i]["title"].ToString()</h4>
}
else
{
string url = "../" +
@ds.Tables[0].Rows[i]["controller"].ToString() + "/" + @ds.Tables[0].Rows[i]["action"].ToString();
<ul
class="top-menu"><li><a
href="@url"
temp_href="@url">@ds.Tables[0].Rows[i]["title"].ToString()</a></li></ul>
}
}
</td>
<td
style="border:
2px double #CCCCCC; padding-left:
50px;" width="30%">
@for (int i =
ds.Tables[0].Rows.Count / 2; i < ds.Tables[0].Rows.Count; i++)
{
if(ds.Tables[0].Rows[i]["action"].ToString()=="")
{
<h4>@ds.Tables[0].Rows[i]["title"].ToString()</h4>
}
else
{
string url = "../" +
@ds.Tables[0].Rows[i]["controller"].ToString() + "/" + @ds.Tables[0].Rows[i]["action"].ToString();
<ul
class="top-menu"><li><a
href="@url"
temp_href="@url">@ds.Tables[0].Rows[i]["title"].ToString()</a></li></ul>
}
}
</td>
</tr>
</table>
}
Run application and check ,all links are working.