web.sitemap
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/WebForm1.aspx" title="首页" description="Home">
<siteMapNode url="~/News.aspx" title="新闻" description="News" >
<siteMapNode url="~/NewsFocus.aspx" title="焦点新闻" description=""/>
<siteMapNode url="~/NewsInside.aspx" title="国内新闻" description=""/>
<siteMapNode url="~/NewsOutside.aspx" title="国际新闻" description=""/>
</siteMapNode>
<siteMapNode url="~/Finance.aspx" title="财经" description="Finance" >
<siteMapNode url="~/Stock.aspx" title="股票" description="" />
<siteMapNode url="~/Money.aspx" title="理财" description="" />
<siteMapNode url="~/Exchange.aspx" title="外汇" description=""/>
<siteMapNode url="~/Fund.aspx" title="基金" description=""/>
</siteMapNode>
<siteMapNode url="~/Internet.aspx" title="互联网" description="Internet" >
<siteMapNode url="~/baidu.aspx" title="百度" description="" />
<siteMapNode url="~/wangyi.aspx" title="网易" description="" />
</siteMapNode>
</siteMapNode>
</siteMap>
webform1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="test12_5.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1" ImageSet="News" NodeIndent="10">
<HoverNodeStyle Font-Underline="True" />
<NodeStyle Font-Names="Arial" Font-Size="10pt" ForeColor="Black" HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />
<ParentNodeStyle Font-Bold="False" />
<SelectedNodeStyle Font-Underline="True" HorizontalPadding="0px" VerticalPadding="0px" />
</asp:TreeView>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
</div>
</form>
</body>
</html>
web.config
<?xml version="1.0" encoding="utf-8"?>
<!--
有关如何配置 ASP.NET 应用程序的详细信息,请访问
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<siteMap defaultProvider="XmlSiteMapProvider1" enabled="true" >
<providers>
<clear/>
<add name="XmlSiteMapProvider1" type="System.Web.XmlSiteMapProvider" siteMapFile="Web.sitemap"/>
</providers>
</siteMap>
</system.web>
</configuration>