SiteMapProvider.CurrentNode 속성

정의

현재 요청된 페이지를 나타내는 SiteMapNode 개체를 가져옵니다.

public:
 virtual property System::Web::SiteMapNode ^ CurrentNode { System::Web::SiteMapNode ^ get(); };
public virtual System.Web.SiteMapNode CurrentNode { get; }
member this.CurrentNode : System.Web.SiteMapNode
Public Overridable ReadOnly Property CurrentNode As SiteMapNode

속성 값

현재 요청된 페이지를 나타내는 SiteMapNode이거나, 그렇지 않고 SiteMapNode가 없거나 현재 사용자에 대해 반환될 수 없으면 null입니다.

예제

다음 코드 예제를 구현 하는 방법에 설명 합니다 CurrentNode 를 구현 하는 클래스의 속성에서에서 SiteMapProvider 클래스입니다.

이 코드 예제는에 대해 제공 된 큰 예제의 일부는 SiteMapProvider 클래스입니다.

// 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 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

설명

SiteMapResolve 검색 하기 전에 이벤트가 발생을 SiteMapNode 개체를 사용 하는 이벤트 구독자의 인스턴스를 반환 하는 SiteMapNode 클래스. 이벤트 구독자가 없는 경우는 SiteMapProvider 클래스를 FindSiteMapNode 현재 HTTP 컨텍스트를 사용 하 여 검색 하는 메서드는 SiteMapNode 현재 요청 된 페이지를 나타내는입니다.

현재 요청 된 페이지를 사용 하 여 해당 하지 않는 경우는 SiteMapNode, null 반환 됩니다. 보안 트리밍이 설정 되어 있으며 사용자가 액세스할 수 없습니다 경우는 SiteMapNode, null 반환 됩니다.

적용 대상

추가 정보