SiteMap.CurrentNode プロパティ
アセンブリ: System.Web (system.web.dll 内)

現在要求されているページを表す SiteMapNode インスタンス。サイト マップ情報に表示するノードがない場合は null 参照 (Visual Basic では Nothing)。


SiteMap クラスは、CurrentNode プロパティをプロバイダから要求して取得します。
サイト マップ情報にそのページについて表示するノードがない場合、またはセキュリティ トリミングが有効でノードを現在のユーザーに返せない場合、null 参照 (Visual Basic では Nothing) が返されます。
1 つ以上のサブスクリプションが存在する場合、既定のサイト マップ プロバイダによって SiteMapResolve イベントが生成されます。
独自の SiteMapProvider オブジェクトを実装する場合は、CurrentNode を検索および取得する独自の機構を作成します。ただし、StaticSiteMapProvider クラスを拡張し、URL ベースのスキームを使用してページを特定する場合は、FindSiteMapNode メソッドをオーバーライドできます。

CurrentNode プロパティを使用して現在のページを表す SiteMapNode オブジェクトを取得する方法のコード例を次に示します。
<Script runat="server"> Private Sub Page_Load(sender As Object, e As EventArgs) ' Examine the CurrentNode, and navigate the SiteMap relative to it. Response.Write(SiteMap.CurrentNode.Title & "<BR>") Response.Write("<FONT COLOR='red'>" & SiteMap.CurrentNode.Url & "</FONT><BR>") ' What nodes are children of the CurrentNode? If (SiteMap.CurrentNode.HasChildNodes) Then Dim ChildNodesEnumerator As IEnumerator = SiteMap.CurrentNode.ChildNodes.GetEnumerator() While (ChildNodesEnumerator.MoveNext()) ' Prints the Title of each node. Response.Write(ChildNodesEnumerator.Current.ToString() & "<BR>") End While End If Response.Write("<HR>") ' Examine the RootNode, and navigate the SiteMap relative to it. Response.Write(SiteMap.RootNode.Title & "<BR>") Response.Write(SiteMap.RootNode.Url & "<BR>") ' What nodes are children of the RootNode? If (SiteMap.RootNode.HasChildNodes) Then Dim RootNodesChildrenEnumerator As IEnumerator = SiteMap.RootNode.ChildNodes.GetEnumerator() While (RootNodesChildrenEnumerator.MoveNext()) ' Prints the Title of each node. Response.Write(RootNodesChildrenEnumerator.Current.ToString() & "<BR>") End While End If End Sub ' Page_Load </Script>
<Script runat="server"> private void Page_Load(object sender, System.EventArgs e) { // Examine the CurrentNode, and navigate the SiteMap relative to it. Response.Write(SiteMap.CurrentNode.Title + "<BR>"); Response.Write("<FONT COLOR='red'>" + SiteMap.CurrentNode.Url + "</FONT><BR>"); // What nodes are children of the CurrentNode? if (SiteMap.CurrentNode.HasChildNodes) { IEnumerator childNodesEnumerator = SiteMap.CurrentNode.ChildNodes.GetEnumerator(); while (childNodesEnumerator.MoveNext()) { // Prints the Title of each node. Response.Write(childNodesEnumerator.Current.ToString() + "<BR>"); } } Response.Write("<HR>"); // Examine the RootNode, and navigate the SiteMap relative to it. Response.Write(SiteMap.RootNode.Title + "<BR>"); Response.Write(SiteMap.RootNode.Url + "<BR>"); // What nodes are children of the RootNode? if (SiteMap.RootNode.HasChildNodes) { IEnumerator rootNodesChildrenEnumerator = SiteMap.RootNode.ChildNodes.GetEnumerator(); while (rootNodesChildrenEnumerator.MoveNext()) { // Prints the Title of each node. Response.Write(rootNodesChildrenEnumerator.Current.ToString() + "<BR>"); } } } </Script>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からSiteMap.CurrentNode プロパティを検索する場合は、下記のリンクをクリックしてください。

- SiteMap.CurrentNode プロパティのページへのリンク