SiteMapProvider 類別

定義

提供所有網站導覽資料提供者的通用基底類別,並讓開發人員實作可以與 ASP.NET 網站導覽基礎結構搭配使用之自訂網站導覽資料提供者,以做為 SiteMap 物件的持續性存放區。Provides a common base class for all site map data providers, and a way for developers to implement custom site map data providers that can be used with the ASP.NET site map infrastructure as persistent stores for SiteMap objects.

public ref class SiteMapProvider abstract : System::Configuration::Provider::ProviderBase
public abstract class SiteMapProvider : System.Configuration.Provider.ProviderBase
type SiteMapProvider = class
    inherit ProviderBase
Public MustInherit Class SiteMapProvider
Inherits ProviderBase
繼承
SiteMapProvider
衍生

範例

下列程式碼範例示範如何撰寫可執行抽象類別的類別 SiteMapProviderThe following code example demonstrates how to write a class that implements the abstract SiteMapProvider class. 這個範例只包含範例 SiteMapProvider 和使用它的範例文字檔。This example includes only a sample SiteMapProvider and a sample text file that works with it. 若要執行範例,您也需要 Web.config 檔案中的專案和 .aspx 頁面。To run the example you also need an entry in the Web.config file and an .aspx page. 您可以在屬性的檔中找到這些內容 SiteMapDataSource.SiteMapProviderYou can find these in the documentation for the SiteMapDataSource.SiteMapProvider property.

此範例會使用以逗號分隔的檔案,該檔案遵循預期的結構來載入網站地圖資訊。The example uses a comma-delimited file that follows an expected structure to load sitemap information. 檔案的第一行代表網站地圖的根節點,而後續的那幾行則是子節點。The first line of the file represents the root node of the sitemap, and subsequent lines are subnodes. 每個子節點都會依 URL 識別其父節點。Each subnode identifies its parent node by URL. 符合這些準則的檔案範例如下所示。An example of a file that meets these criteria is shown below.

default.aspx,Home,MyCompany Home Page,  
sale.aspx,Now On Sale,Check Out These Great Deals!,default.aspx  
catalog.aspx,Online Catalog,Browse Our Many Great Items!,default.aspx  

SimpleTextSiteMapProvider提供所有 SiteMapProvider 屬性和方法的範例執行。The SimpleTextSiteMapProvider provides example implementations of all the SiteMapProvider properties and methods.

using System;
using System.Configuration.Provider;
using System.Collections;
using System.Collections.Specialized;
using System.IO;
using System.Security.Permissions;
using System.Web;

namespace Samples.AspNet.CS
{

  [AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Minimal)]
  public class SimpleTextSiteMapProvider : SiteMapProvider
  {
    private SiteMapProvider parentSiteMapProvider = null;
    private string simpleTextProviderName = null;
    private string sourceFilename = null;
    private SiteMapNode rootNode = null;
    private ArrayList siteMapNodes = null;
    private ArrayList childParentRelationship = null;

    // A default constructor. The Name property is initialized in the
    // Initialize method.
    public SimpleTextSiteMapProvider()
    {
    }
    // Implement the CurrentNode property.
    public override SiteMapNode CurrentNode
    {
      get
      {
        string currentUrl = FindCurrentUrl();
        // Find the SiteMapNode that represents the current page.
        SiteMapNode currentNode = FindSiteMapNode(currentUrl);
        return currentNode;
      }
    }

    // Implement the RootNode property.
    public override SiteMapNode RootNode
    {
      get
      {
        return rootNode;
      }
    }
    // Implement the ParentProvider property.
    public override SiteMapProvider ParentProvider
    {
      get
      {
        return parentSiteMapProvider;
      }
      set
      {
        parentSiteMapProvider = value;
      }
    }

    // Implement the RootProvider property.
    public override SiteMapProvider RootProvider
    {
      get
      {
        // If the current instance belongs to a provider hierarchy, it
        // cannot be the RootProvider. Rely on the ParentProvider.
        if (this.ParentProvider != null)
        {
          return ParentProvider.RootProvider;
        }
        // If the current instance does not have a ParentProvider, it is
        // not a child in a hierarchy, and can be the RootProvider.
        else
        {
          return this;
        }
      }
    }
    // Implement the FindSiteMapNode method.
    public override SiteMapNode FindSiteMapNode(string rawUrl)
    {

      // Does the root node match the URL?
      if (RootNode.Url == rawUrl)
      {
        return RootNode;
      }
      else
      {
        SiteMapNode candidate = null;
        // Retrieve the SiteMapNode that matches the URL.
        lock (this)
        {
          candidate = GetNode(siteMapNodes, rawUrl);
        }
        return candidate;
      }
    }
    // Implement the GetChildNodes method.
    public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
    {
      SiteMapNodeCollection children = new SiteMapNodeCollection();
      // Iterate through the ArrayList and find all nodes that have the specified node as a parent.
      lock (this)
      {
        for (int i = 0; i < childParentRelationship.Count; i++)
        {

          string nodeUrl = ((DictionaryEntry)childParentRelationship[i]).Key as string;

          SiteMapNode parent = GetNode(childParentRelationship, nodeUrl);

          if (parent != null && node.Url == parent.Url)
          {
            // The SiteMapNode with the Url that corresponds to nodeUrl
            // is a child of the specified node. Get the SiteMapNode for
            // the nodeUrl.
            SiteMapNode child = FindSiteMapNode(nodeUrl);
            if (child != null)
            {
              children.Add(child as SiteMapNode);
            }
            else
            {
              throw new Exception("ArrayLists not in sync.");
            }
          }
        }
      }
      return children;
    }
    protected override SiteMapNode GetRootNodeCore()
    {
      return RootNode;
    }
    // Implement the GetParentNode method.
    public override SiteMapNode GetParentNode(SiteMapNode node)
    {
      // Check the childParentRelationship table and find the parent of the current node.
      // If there is no parent, the current node is the RootNode.
      SiteMapNode parent = null;
      lock (this)
      {
        // Get the Value of the node in childParentRelationship
        parent = GetNode(childParentRelationship, node.Url);
      }
      return parent;
    }

    // Implement the ProviderBase.Initialize property.
    // Initialize is used to initialize the state that the Provider holds, but
    // not actually build the site map.
    public override void Initialize(string name, NameValueCollection attributes)
    {

      lock (this)
      {

        base.Initialize(name, attributes);

        simpleTextProviderName = name;
        sourceFilename = attributes["siteMapFile"];
        siteMapNodes = new ArrayList();
        childParentRelationship = new ArrayList();

        // Build the site map in memory.
        LoadSiteMapFromStore();
      }
    }
    // Private helper methods

    private SiteMapNode GetNode(ArrayList list, string url)
    {
      for (int i = 0; i < list.Count; i++)
      {
        DictionaryEntry item = (DictionaryEntry)list[i];
        if ((string)item.Key == url)
          return item.Value as SiteMapNode;
      }
      return null;
    }

    // Get the URL of the currently displayed page.
    private string FindCurrentUrl()
    {
      try
      {
        // The current HttpContext.
        HttpContext currentContext = HttpContext.Current;
        if (currentContext != null)
        {
          return currentContext.Request.RawUrl;
        }
        else
        {
          throw new Exception("HttpContext.Current is Invalid");
        }
      }
      catch (Exception e)
      {
        throw new NotSupportedException("This provider requires a valid context.",e);
      }
    }
    protected virtual void LoadSiteMapFromStore()
    {
      string pathToOpen;

      lock (this)
      {
        // If a root node exists, LoadSiteMapFromStore has already
        // been called, and the method can return.
        if (rootNode != null)
        {
          return;
        }
        else
        {
          pathToOpen = HttpContext.Current.Server.MapPath("~" + "\\" + sourceFilename);

          if (File.Exists(pathToOpen))
          {
            // Open the file to read from.
            using (StreamReader sr = File.OpenText(pathToOpen))
            {

              // Clear the state of the collections and rootNode
              rootNode = null;
              siteMapNodes.Clear();
              childParentRelationship.Clear();

              // Parse the file and build the site map
              string s = "";
              string[] nodeValues = null;
              SiteMapNode temp = null;

              while ((s = sr.ReadLine()) != null)
              {

                // Build the various SiteMapNode objects and add
                // them to the ArrayList collections. The format used
                // is: URL,TITLE,DESCRIPTION,PARENTURL

                nodeValues = s.Split(',');

                temp = new SiteMapNode(this,
                    HttpRuntime.AppDomainAppVirtualPath + "/" + nodeValues[0],
                    HttpRuntime.AppDomainAppVirtualPath + "/" + nodeValues[0],
                    nodeValues[1],
                    nodeValues[2]);

                // Is this a root node yet?
                if (null == rootNode &&
                    string.IsNullOrEmpty(nodeValues[3]))
                {
                  rootNode = temp;
                }

              // If not the root node, add the node to the various collections.
                else
                {
                  siteMapNodes.Add(new DictionaryEntry(temp.Url, temp));
                  // The parent node has already been added to the collection.
                  SiteMapNode parentNode =
                           FindSiteMapNode(HttpRuntime.AppDomainAppVirtualPath + "/" + nodeValues[3]);
                  if (parentNode != null)
                  {
                    childParentRelationship.Add(new DictionaryEntry(temp.Url, parentNode));
                  }
                  else
                  {
                    throw new Exception("Parent node not found for current node.");
                  }
                }
              }
            }
          }
          else
          {
            throw new Exception("File not found");
          }
        }
      }
      return;
    }
  }
}
Imports System.Collections
Imports System.Collections.Specialized
Imports System.Configuration.Provider
Imports System.IO
Imports System.Security.Permissions
Imports System.Web

Namespace Samples.AspNet.VB

  <AspNetHostingPermission(SecurityAction.Demand, Level:=AspNetHostingPermissionLevel.Minimal)> _
  Public Class SimpleTextSiteMapProvider
    Inherits SiteMapProvider

    Private parentSiteMapProvider As SiteMapProvider = Nothing
    Private simpleTextProviderName As String = Nothing
    Private sourceFilename As String = Nothing
    Private aRootNode As SiteMapNode = Nothing
    Private siteMapNodes As ArrayList = Nothing
    Private childParentRelationship As ArrayList = Nothing

    ' A default constructor. The Name property is initialized in the
    ' Initialize method.
    Public Sub New()
    End Sub

    ' Implement the CurrentNode property.
    Public Overrides ReadOnly Property CurrentNode() As SiteMapNode
      Get
        Dim currentUrl As String = FindCurrentUrl()
        ' Find the SiteMapNode that represents the current page.
        Dim aCurrentNode As SiteMapNode = FindSiteMapNode(currentUrl)
        Return aCurrentNode
      End Get
    End Property

    ' Implement the RootNode property.
    Public Overrides ReadOnly Property RootNode() As SiteMapNode
      Get
        Return aRootNode
      End Get
    End Property

    ' Implement the ParentProvider property.
    Public Overrides Property ParentProvider() As SiteMapProvider
      Get
        Return parentSiteMapProvider
      End Get
      Set(ByVal value As SiteMapProvider)
        parentSiteMapProvider = Value
      End Set
    End Property

    ' Implement the RootProvider property.
    Public Overrides ReadOnly Property RootProvider() As SiteMapProvider
      Get
        ' If the current instance belongs to a provider hierarchy, it
        ' cannot be the RootProvider. Rely on the ParentProvider.
        If Not (Me.ParentProvider Is Nothing) Then
          Return ParentProvider.RootProvider
          ' If the current instance does not have a ParentProvider, it is
          ' not a child in a hierarchy, and can be the RootProvider.
        Else
          Return Me
        End If
      End Get
    End Property

    ' Implement the FindSiteMapNode method.
    Public Overrides Function FindSiteMapNode(ByVal rawUrl As String) As SiteMapNode
      ' Does the root node match the URL?
      If RootNode.Url = rawUrl Then
        Return RootNode
      Else
        Dim candidate As SiteMapNode = Nothing
        ' Retrieve the SiteMapNode that matches the URL.
        SyncLock Me
          candidate = GetNode(siteMapNodes, rawUrl)
        End SyncLock
        Return candidate
      End If
    End Function 'FindSiteMapNode

    ' Implement the GetChildNodes method.
    Public Overrides Function GetChildNodes(ByVal node As SiteMapNode) As SiteMapNodeCollection
      Dim children As New SiteMapNodeCollection()
      ' Iterate through the ArrayList and find all nodes that have the specified node as a parent.
      SyncLock Me
        Dim i As Integer
        For i = 0 To childParentRelationship.Count - 1

          Dim de As DictionaryEntry = CType(childParentRelationship(i), DictionaryEntry)
          Dim nodeUrl As String = CType(de.Key, String)

          Dim parent As SiteMapNode = GetNode(childParentRelationship, nodeUrl)

          If Not (parent Is Nothing) AndAlso node.Url = parent.Url Then
            ' The SiteMapNode with the Url that corresponds to nodeUrl
            ' is a child of the specified node. Get the SiteMapNode for
            ' the nodeUrl.
            Dim child As SiteMapNode = FindSiteMapNode(nodeUrl)
            If Not (child Is Nothing) Then
              children.Add(CType(child, SiteMapNode))
            Else
              Throw New Exception("ArrayLists not in sync.")
            End If
          End If
        Next i
      End SyncLock
      Return children
    End Function 'GetChildNodes

    Protected Overrides Function GetRootNodeCore() As SiteMapNode
      Return RootNode
    End Function ' GetRootNodeCore()

    ' Implement the GetParentNode method.
    Public Overrides Function GetParentNode(ByVal node As SiteMapNode) As SiteMapNode
      ' Check the childParentRelationship table and find the parent of the current node.
      ' If there is no parent, the current node is the RootNode.
      Dim parent As SiteMapNode = Nothing
      SyncLock Me
        ' Get the Value of the node in childParentRelationship
        parent = GetNode(childParentRelationship, node.Url)
      End SyncLock
      Return parent
    End Function 'GetParentNode

    ' Implement the ProviderBase.Initialize method.
    ' Initialize is used to initialize the state that the Provider holds, but
    ' not actually build the site map.
    Public Overrides Sub Initialize(ByVal name As String, ByVal attributes As NameValueCollection)
      SyncLock Me
        MyBase.Initialize(name, attributes)
        simpleTextProviderName = name
        sourceFilename = attributes("siteMapFile")
        siteMapNodes = New ArrayList()
        childParentRelationship = New ArrayList()
        ' Build the site map in memory.
        LoadSiteMapFromStore()
      End SyncLock
    End Sub

    ' Private helper methods
    Private Function GetNode(ByVal list As ArrayList, ByVal url As String) As SiteMapNode
      Dim i As Integer
      For i = 0 To list.Count - 1
        Dim item As DictionaryEntry = CType(list(i), DictionaryEntry)
        If CStr(item.Key) = url Then
          Return CType(item.Value, SiteMapNode)
        End If
      Next i
      Return Nothing
    End Function 'GetNode


    ' Get the URL of the currently displayed page.
    Private Function FindCurrentUrl() As String
      Try
        ' The current HttpContext.
        Dim currentContext As HttpContext = HttpContext.Current
        If Not (currentContext Is Nothing) Then
          Return currentContext.Request.RawUrl
        Else
          Throw New Exception("HttpContext.Current is Invalid")
        End If
      Catch e As Exception
        Throw New NotSupportedException("This provider requires a valid context.", e)
      End Try
    End Function 'FindCurrentUrl

    Protected Overridable Sub LoadSiteMapFromStore()
      Dim pathToOpen As String
      SyncLock Me
        ' If a root node exists, LoadSiteMapFromStore has already
        ' been called, and the method can return.
        If Not (aRootNode Is Nothing) Then
          Return
        Else
          pathToOpen = HttpContext.Current.Server.MapPath("~" & "\\" & sourceFilename)
          If File.Exists(pathToOpen) Then
            ' Open the file to read from.
            Dim sr As StreamReader = File.OpenText(pathToOpen)
            Try

              ' Clear the state of the collections and aRootNode
              aRootNode = Nothing
              siteMapNodes.Clear()
              childParentRelationship.Clear()

              ' Parse the file and build the site map
              Dim s As String = ""
              Dim nodeValues As String() = Nothing
              Dim temp As SiteMapNode = Nothing

              Do
                s = sr.ReadLine()

                If Not s Is Nothing Then
                  ' Build the various SiteMapNode objects and add
                  ' them to the ArrayList collections. The format used
                  ' is: URL,TITLE,DESCRIPTION,PARENTURL
                  nodeValues = s.Split(","c)

                  temp = New SiteMapNode(Me, _
                      HttpRuntime.AppDomainAppVirtualPath & "/" & nodeValues(0), _
                      HttpRuntime.AppDomainAppVirtualPath & "/" & nodeValues(0), _
                      nodeValues(1), _
                      nodeValues(2))

                  ' Is this a root node yet?
                  If aRootNode Is Nothing AndAlso _
                    (nodeValues(3) Is Nothing OrElse _
                     nodeValues(3) = String.Empty) Then
                    aRootNode = temp

                    ' If not the root node, add the node to the various collections.
                  Else

                    siteMapNodes.Add(New DictionaryEntry(temp.Url, temp))

                    ' The parent node has already been added to the collection.
                    Dim parentNode As SiteMapNode = _
                        FindSiteMapNode(HttpRuntime.AppDomainAppVirtualPath & "/" & nodeValues(3))

                    If Not (parentNode Is Nothing) Then
                      childParentRelationship.Add(New DictionaryEntry(temp.Url, parentNode))
                    Else
                      Throw New Exception("Parent node not found for current node.")
                    End If
                  End If
                End If
              Loop Until s Is Nothing
            Finally
              sr.Close()
            End Try
          Else
            Throw New Exception("File not found")
          End If
        End If
      End SyncLock
      Return
    End Sub
  End Class
End Namespace

備註

StaticSiteMapProviderXmlSiteMapProvider 類別代表抽象類別的預設執行 SiteMapProviderThe StaticSiteMapProvider and XmlSiteMapProvider classes represent the default implementations of the abstract SiteMapProvider class. XmlSiteMapProvider 使用名為 system.web 的 XML 檔案來儲存網站地圖資料。The XmlSiteMapProvider uses an XML file named Web.sitemap to store site map data. 如需有關網站地圖檔案的詳細資訊,請參閱 ASP.NET 網站地圖For more information on about the Web.sitemap file, see ASP.NET Site Maps.

SiteMapProvider類別藉由宣告和屬性,支援網站地圖提供者階層的概念 RootProvider ParentProviderThe SiteMapProvider class supports the concept of a site map provider hierarchy, by declaring the RootProvider and ParentProvider properties. SiteMapProvider可以是另一個提供者的子系或父系。A SiteMapProvider can be a child or parent of another provider. 這可讓不同的開發群組擁有或實行網站的不同內容區域,以維護自己的網站對應和網站地圖提供者。This enables scenarios where different content areas of a site are owned or implemented by different development groups that maintain their own site maps and site map providers.

所有 SiteMapProvider 物件都是在 Web.config 檔案中設定。All SiteMapProvider objects are configured in the Web.config files. 這些設定檔中所宣告的任何網站地圖提供者都會在執行時間載入,並用來載入和處理網站導覽資料。Any site map providers that are declared in these configuration files are loaded at run time and are used to load and process site navigation data. SiteMap物件,它會追蹤透過其屬性集合提供的所有提供者 Providers ,並以程式設計方式存取提供者所管理的導覽資料。The SiteMap object, which keeps track of all the providers that are available to it through its Providers property collection, provides programmatic access to the navigation data that is managed by the providers. 下列程式碼範例示範用來在 Web.config 檔案中宣告網站地圖提供者的格式。The following code example demonstrates the format that is used to declare a site map provider in a Web.config file.

<siteMap defaultProvider="<name>">  
  <providers>  
    <add  
      name="<friendly name>"  
      type="<fully qualified class name>, <assembly name (optional)>"   
      siteMapFile = "<file name>" />  
  </providers>  
</siteMap>  

這些提供者載入的網站導覽資料會由網站地圖基礎結構的其他元件(例如 SiteMapPathTreeView 控制項)用來顯示使用者的網站地圖資訊。The site navigation data that is loaded by these providers is used by other components of the site map infrastructure, such as the SiteMapPath and TreeView controls, to display site map information for users.

如果您執行自己的網站地圖提供者,您可以將來源檔案放在 ASP.NET 應用程式的 App_Code 目錄中,然後將會自動編譯元件。If you implement your own site map provider, you can place the source file in the App_Code directory of your ASP.NET application, and then the assembly will be compiled automatically. 您也可以將自己的網站地圖提供者放在全域組件快取中 (GAC) ,並在 Web.config 檔案中提供它的完整參考。You can also place your own site map provider in the Global Assembly Cache (GAC), and provide a fully-qualified reference to it in the Web.config file. 如需編譯器服務的詳細資訊,請參閱 使用元件和全域組件快取For more information on compiler services, see Working with Assemblies and the Global Assembly Cache.

給實施者的注意事項

當您從類別繼承時 SiteMapProvider ,您必須覆寫下列成員: GetRootNodeCore()FindSiteMapNode(String)GetChildNodes(SiteMapNode)GetParentNode(SiteMapNode)When you inherit from the SiteMapProvider class, you must override the following members: GetRootNodeCore(), FindSiteMapNode(String), GetChildNodes(SiteMapNode), and GetParentNode(SiteMapNode).

建構函式

SiteMapProvider()

初始化 SiteMapProvider 類別的新執行個體。Initializes a new instance of the SiteMapProvider class.

屬性

CurrentNode

取得代表目前所要求頁面的 SiteMapNode 物件。Gets the SiteMapNode object that represents the currently requested page.

Description

取得簡短、易讀的描述,適合顯示在管理工具或其他使用者介面 (UI) 中。Gets a brief, friendly description suitable for display in administrative tools or other user interfaces (UIs).

(繼承來源 ProviderBase)
EnableLocalization

取得或設定布林值,指出是否傳回 SiteMapNode 屬性的當地語系化值。Gets or sets a Boolean value indicating whether localized values of SiteMapNode attributes are returned.

Name

取得用來在設定期間代表提供者的易記名稱。Gets the friendly name used to refer to the provider during configuration.

(繼承來源 ProviderBase)
ParentProvider

取得或設定目前提供者的父代 SiteMapProvider 物件。Gets or sets the parent SiteMapProvider object of the current provider.

ResourceKey

取得或設定用來當地語系化 SiteMapNode 屬性的資源索引鍵。Get or sets the resource key that is used for localizing SiteMapNode attributes.

RootNode

取得目前提供者所表示之網站導覽資料的根 SiteMapNode 物件。Gets the root SiteMapNode object of the site map data that the current provider represents.

RootProvider

取得目前提供者階層架構中的根 SiteMapProvider 物件。Gets the root SiteMapProvider object in the current provider hierarchy.

SecurityTrimmingEnabled

取得布林值,指出網站導覽提供者是否根據使用者的角色篩選網站導覽節點。Gets a Boolean value indicating whether a site map provider filters site map nodes based on a user's role.

方法

AddNode(SiteMapNode)

SiteMapNode 物件加入至網站導覽提供者所維護的節點集合。Adds a SiteMapNode object to the node collection that is maintained by the site map provider.

AddNode(SiteMapNode, SiteMapNode)

SiteMapNode 物件加入至網站導覽提供者所維護的節點集合中,並且指定父代 SiteMapNode 物件。Adds a SiteMapNode object to the node collection that is maintained by the site map provider and specifies the parent SiteMapNode object.

Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
FindSiteMapNode(HttpContext)

使用指定的 SiteMapNode 物件,擷取表示目前所要求之網頁的 HttpContext 物件。Retrieves a SiteMapNode object that represents the currently requested page using the specified HttpContext object.

FindSiteMapNode(String)

在衍生類別中覆寫時,擷取表示位於指定 URL 之網頁的 SiteMapNode 物件。When overridden in a derived class, retrieves a SiteMapNode object that represents the page at the specified URL.

FindSiteMapNodeFromKey(String)

根據指定的索引鍵,擷取 SiteMapNode 物件。Retrieves a SiteMapNode object based on a specified key.

GetChildNodes(SiteMapNode)

在衍生類別中覆寫時,擷取特定 SiteMapNode 的子節點。When overridden in a derived class, retrieves the child nodes of a specific SiteMapNode.

GetCurrentNodeAndHintAncestorNodes(Int32)

當擷取目前所要求之網頁的節點,以及擷取目前網頁的父代和祖系網站導覽節點時,提供網站導覽提供者的最佳化查閱方法。Provides an optimized lookup method for site map providers when retrieving the node for the currently requested page and fetching the parent and ancestor site map nodes for the current page.

GetCurrentNodeAndHintNeighborhoodNodes(Int32, Int32)

當擷取目前所要求之網頁的節點,以及擷取目前節點附近的網站導覽節點時,提供網站導覽提供者的最佳化查閱方法。Provides an optimized lookup method for site map providers when retrieving the node for the currently requested page and fetching the site map nodes in the proximity of the current node.

GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(繼承來源 Object)
GetParentNode(SiteMapNode)

在衍生類別中覆寫時,擷取特定 SiteMapNode 物件的父節點。When overridden in a derived class, retrieves the parent node of a specific SiteMapNode object.

GetParentNodeRelativeToCurrentNodeAndHintDownFromParent(Int32, Int32)

當擷取目前所要求之網頁的祖系節點,以及擷取祖系的子代節點時,提供網站導覽提供者的最佳化查閱方法。Provides an optimized lookup method for site map providers when retrieving an ancestor node for the currently requested page and fetching the descendant nodes for the ancestor.

GetParentNodeRelativeToNodeAndHintDownFromParent(SiteMapNode, Int32, Int32)

當擷取指定 SiteMapNode 物件的祖系節點,以及擷取其子節點時,提供網站導覽提供者的最佳化查閱方法。Provides an optimized lookup method for site map providers when retrieving an ancestor node for the specified SiteMapNode object and fetching its child nodes.

GetRootNodeCore()

在衍生類別中覆寫時,擷取目前提供者目前所管理之所有節點的根節點。When overridden in a derived class, retrieves the root node of all the nodes that are currently managed by the current provider.

GetRootNodeCoreFromProvider(SiteMapProvider)

擷取指定網站導覽提供者目前所管理之所有節點的根節點。Retrieves the root node of all the nodes that are currently managed by the specified site map provider.

GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
HintAncestorNodes(SiteMapNode, Int32)

提供方法,讓網站導覽提供者可以覆寫,以最佳化方式擷取相對於指定 SiteMapNode 物件的一或多個層級之父代和祖系節點。Provides a method that site map providers can override to perform an optimized retrieval of one or more levels of parent and ancestor nodes, relative to the specified SiteMapNode object.

HintNeighborhoodNodes(SiteMapNode, Int32, Int32)

提供方法,讓網站導覽提供者可以覆寫,以最佳化方式擷取指定節點附近找到的節點。Provides a method that site map providers can override to perform an optimized retrieval of nodes found in the proximity of the specified node.

Initialize(String, NameValueCollection)

初始化 SiteMapProvider 實作,包括從持續性儲存體載入網站導覽資料時所需的任何資源。Initializes the SiteMapProvider implementation, including any resources that are needed to load site map data from persistent storage.

IsAccessibleToUser(HttpContext, SiteMapNode)

擷取布林值,指出在指定內容中使用者是否可以檢視指定的 SiteMapNode 物件。Retrieves a Boolean value indicating whether the specified SiteMapNode object can be viewed by the user in the specified context.

MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
RemoveNode(SiteMapNode)

從網站導覽提供者所維護的節點集合中,移除指定的 SiteMapNode 物件。Removes the specified SiteMapNode object from the node collection that is maintained by the site map provider.

ResolveSiteMapNode(HttpContext)

引發 SiteMapResolve 事件。Raises the SiteMapResolve event.

ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)

事件

SiteMapResolve

呼叫 CurrentNode 屬性時發生。Occurs when the CurrentNode property is called.

適用於

另請參閱