📄 sitemapapi.aspx.cs
字号:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class SiteMapAPI : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//显示根节点的Url与Title
Response.Write("<OL>");
Response.Write("<li>根节点路径为:" + SiteMap.RootNode.Url + "</li>");
Response.Write("<li>根节点Title为:" + SiteMap.RootNode.Title + "</li>");
Response.Write("<li>根节点Provider为:" + SiteMap.RootNode.Provider.Name + "</li>");
//检测显示根节点下面是否还含有子节点
if (SiteMap.RootNode.HasChildNodes)
{
Response.Write("<li>根节点是否还包含子节点:" + SiteMap.RootNode.HasChildNodes+"</li></OL>");
//通过列举取得其下节点
IEnumerator rootNodesChildrenEnumerator = SiteMap.RootNode.ChildNodes.GetEnumerator();
Response.Write("根节点下的父节点为:");
while (rootNodesChildrenEnumerator.MoveNext())
{
//显示子节点
Response.Write("<pre> +--" + rootNodesChildrenEnumerator.Current.ToString() + "</pre>");
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -