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

名前付き SiteMapProvider オブジェクトの SiteMapProviderCollection。


Providers コレクションにリストされているサイト マップ プロバイダは、SiteMap クラスを初期化するために構成階層に指定されているプロバイダです。初期化中に SiteMap により使用されることが保証されるのは、既定のプロバイダ (Provider プロパティで指定) のみです。Providers コレクションにプロバイダが存在しているということは、それが構成に指定されていて、初期化中に使用可能であったことを意味します。

Providers コレクションを SiteMap クラスから取得して、それを反復処理する方法のコード例を次に示します。
<%@ Page Language="VB" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <SCRIPT runat="server"> Private Sub Page_Load(Sender As Object, E As EventArgs) ' Navigate the SiteMap built by the default SiteMapProvider. Response.Write(SiteMap.RootNode.ToString() & "<BR>") Response.Write(SiteMap.RootNode.Url & "<BR>") Response.Write(SiteMap.RootNode.Title & "<BR>") Dim sitemapnode As SiteMapNode For Each sitemapnode In SiteMap.RootNode.ChildNodes ' Iterate through the ChildNodes SiteMapNodesCollection ' maintained by the RootNode. Response.Write(sitemapnode.Url & "<BR>" ) Next Dim providers As IDictionaryEnumerator = SiteMap.Providers.GetEnumerator() While (providers.MoveNext()) Response.Write(providers.Current) Response.Write(" ") Response.Write("<BR>") End While End Sub ' Page_Load </SCRIPT>
<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <SCRIPT runat="server"> private void Page_Load(object sender, System.EventArgs e) { // Navigate the SiteMap built by the default SiteMapProvider. Response.Write(SiteMap.RootNode.ToString() + "<BR>"); Response.Write(SiteMap.RootNode.Url + "<BR>"); Response.Write(SiteMap.RootNode.Title + "<BR>"); foreach (SiteMapNode sitemapnode in SiteMap.RootNode.ChildNodes) { // Iterate through the ChildNodes SiteMapNodesCollection // maintained by the RootNode. Response.Write(sitemapnode.Url + "<BR>" ); } IEnumerator providers = SiteMap.Providers.GetEnumerator(); while (providers.MoveNext()) { Response.Write(providers.Current); Response.Write(" "); Response.Write("<BR>"); } } </SCRIPT>
サイトに構成されているプロバイダが既定のプロバイダだけではない場合、各プロバイダが表示されます。たとえば、サンプルの Microsoft Access プロバイダ (「StaticSiteMapProvider」を参照) を使用している場合、次の出力が表示されます。
XmlSiteMapProvider System.Web.XmlSiteMapProvider AccessSiteMapProvider Samples.AspNet.AccessSiteMapProvider

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


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