SiteMapResolveEventArgsとは? わかりやすく解説

SiteMapResolveEventArgs クラス

メモ : このクラスは、.NET Framework version 2.0 で新しく追加されたものです。

SiteMapProvider クラスの CurrentNode プロパティを呼び出すことによって発生するイベントに関するデータを提供します。

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Class SiteMapResolveEventArgs
    Inherits EventArgs
Dim instance As SiteMapResolveEventArgs
public class SiteMapResolveEventArgs : EventArgs
public ref class SiteMapResolveEventArgs :
 public EventArgs
public class SiteMapResolveEventArgs extends
 EventArgs
public class SiteMapResolveEventArgs extends
 EventArgs
解説解説

SiteMapResolveEventArgs クラスを ResolveSiteMapNode メソッドで使用すると、SiteMapResolve イベントのサブスクライバで SiteMapNode クラスのインスタンスを返すことができます。SiteMapResolve イベントを処理するイベント ハンドラ デリゲートを追加することによって、カスタム サイト マップ プロバイダを実装しなくてもページの SiteMapNode 表現を作成できます。

使用例使用例

SiteMapResolve イベントを ASP.NET Web ページで処理して、SiteMapPath コントロールなどのサイト ナビゲーション コントロールにより表示される URL を変更する方法を示すコード例を次に示します。この例では、現在のページはオンラインの掲示板またはフォーラムの投稿ページです。より意味のあるサイト ナビゲーションを実現するため、ナビゲーション コントロールにより表示されるノードの URL が、コンテキストに関連するクエリ文字列に付加されます。

メモ   CurrentNode プロパティに SiteMapResolveEventHandler クラスの中からアクセスしても安全です。この場合、ASP.NET サイト ナビゲーション インフラストラクチャが無限の再帰を防ぎます。

Private Sub Page_Load(ByVal
 sender As Object, ByVal
 e As EventArgs)

    ' The ExpandForumPaths method is called to handle
    ' the SiteMapResolve event.
    AddHandler SiteMap.SiteMapResolve, AddressOf
 Me.ExpandForumPaths

End Sub

Private Function ExpandForumPaths(ByVal
 sender As Object, ByVal
 e As SiteMapResolveEventArgs) As SiteMapNode
    ' The current node represents a Post page in a bulletin board forum.
    ' Clone the current node and all of its relevant parents. This
    ' returns a site map node that a developer can then
    ' walk, modifying each node.Url property in turn.
    ' Since the cloned nodes are separate from the underlying
    ' site navigation structure, the fixups that are made do not
    ' effect the overall site navigation structure.
    Dim currentNode As SiteMapNode = SiteMap.CurrentNode.Clone(True)
    Dim tempNode As SiteMapNode = currentNode

    ' Obtain the recent IDs.
    Dim forumGroupID As Integer
 = GetMostRecentForumGroupID()
    Dim forumID As Integer
 = GetMostRecentForumID(forumGroupID)
    Dim postID As Integer
 = GetMostRecentPostID(forumID)

    ' The current node, and its parents, can be modified to include
    ' dynamic querystring information relevant to the currently
    ' executing request.
    If Not (0 = postID) Then
        tempNode.Url = tempNode.Url & "?PostID="
 & postID.ToString()
    End If

    tempNode = tempNode.ParentNode
    If Not (0 = forumID) And
 Not (tempNode Is Nothing)
 Then
        tempNode.Url = tempNode.Url & "?ForumID="
 & forumID.ToString()
    End If

    tempNode = tempNode.ParentNode
    If Not (0 = ForumGroupID) And
 Not (tempNode Is Nothing)
 Then
        tempNode.Url = tempNode.Url & "?ForumGroupID="
 & forumGroupID.ToString()
    End If

    Return currentNode

End Function

private void Page_Load(object sender, EventArgs
 e)
{
    // The ExpandForumPaths method is called to handle
    // the SiteMapResolve event.
    SiteMap.SiteMapResolve +=
      new SiteMapResolveEventHandler(this.ExpandForumPaths);
}

private SiteMapNode ExpandForumPaths(Object sender, SiteMapResolveEventArgs
 e)
{
    // The current node represents a Post page in a bulletin board forum.
    // Clone the current node and all of its relevant parents. This
    // returns a site map node that a developer can then
    // walk, modifying each node.Url property in turn.
    // Since the cloned nodes are separate from the underlying
    // site navigation structure, the fixups that are made do not
    // effect the overall site navigation structure.
    SiteMapNode currentNode = SiteMap.CurrentNode.Clone(true);
    SiteMapNode tempNode = currentNode;

    // Obtain the recent IDs.
    int forumGroupID = GetMostRecentForumGroupID();
    int forumID = GetMostRecentForumID(forumGroupID);
    int postID = GetMostRecentPostID(forumID);

    // The current node, and its parents, can be modified to include
    // dynamic querystring information relevant to the currently
    // executing request.
    if (0 != postID)
    {
        tempNode.Url = tempNode.Url + "?PostID=" + postID.ToString();
    }

    if ((null != (tempNode = tempNode.ParentNode))
 &&
        (0 != forumID))
    {
        tempNode.Url = tempNode.Url + "?ForumID=" + forumID.ToString();
    }

    if ((null != (tempNode = tempNode.ParentNode))
 &&
        (0 != forumGroupID))
    {
        tempNode.Url = tempNode.Url + "?ForumGroupID=" + forumGroupID.ToString();
    }

    return currentNode;
}
.NET Framework のセキュリティ.NET Framework のセキュリティ
継承階層継承階層
System.Object
   System.EventArgs
    System.Web.SiteMapResolveEventArgs
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SiteMapResolveEventArgs メンバ
System.Web 名前空間
SiteMapResolveEventHandler
SiteMap.SiteMapResolve イベント

SiteMapResolveEventArgs コンストラクタ

メモ : このコンストラクタは、.NET Framework version 2.0 で新しく追加されたものです。

指定した HttpContext オブジェクトと SiteMapProvider オブジェクトを使用して、SiteMapResolveEventArgs クラスの新しいインスタンスを初期化します。

名前空間: System.Web
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public Sub New ( _
    context As HttpContext, _
    provider As SiteMapProvider _
)
Dim context As HttpContext
Dim provider As SiteMapProvider

Dim instance As New SiteMapResolveEventArgs(context,
 provider)
public SiteMapResolveEventArgs (
    HttpContext context,
    SiteMapProvider provider
)
public:
SiteMapResolveEventArgs (
    HttpContext^ context, 
    SiteMapProvider^ provider
)
public SiteMapResolveEventArgs (
    HttpContext context, 
    SiteMapProvider provider
)
public function SiteMapResolveEventArgs (
    context : HttpContext, 
    provider : SiteMapProvider
)

パラメータ

context

現在のページ要求のコンテキストを表す HttpContext。

provider

SiteMapResolve イベントの発生元の SiteMapProvider。

解説解説

context パラメータと provider パラメータが両方とも null 参照 (Visual Basic では Nothing) でもかまいません。

XmlSiteMapProvider オブジェクトは、SiteMapResolveEventArgs クラスの新しいインスタンスを null 参照 (Visual Basic では Nothing) ではない値で初期化します。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
SiteMapResolveEventArgs クラス
SiteMapResolveEventArgs メンバ
System.Web 名前空間
ResolveSiteMapNode

SiteMapResolveEventArgs プロパティ


パブリック プロパティパブリック プロパティ

参照参照

関連項目

SiteMapResolveEventArgs クラス
System.Web 名前空間
SiteMapResolveEventHandler
SiteMap.SiteMapResolve イベント

SiteMapResolveEventArgs メソッド


SiteMapResolveEventArgs メンバ

SiteMapProvider クラスの CurrentNode プロパティを呼び出すことによって発生するイベントに関するデータを提供します。

SiteMapResolveEventArgs データ型で公開されるメンバを以下の表に示します。


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド SiteMapResolveEventArgs 指定した HttpContext オブジェクトと SiteMapProvider オブジェクトを使用して、SiteMapResolveEventArgs クラスの新しいインスタンスを初期化します。
パブリック プロパティパブリック プロパティ
パブリック メソッドパブリック メソッド
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

SiteMapResolveEventArgs クラス
System.Web 名前空間
SiteMapResolveEventHandler
SiteMap.SiteMapResolve イベント



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

「SiteMapResolveEventArgs」の関連用語

SiteMapResolveEventArgsのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SiteMapResolveEventArgsのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS