SiteMapProvider.CurrentNode Property
Assembly: System.Web (in system.web.dll)
'Declaration Public Overridable ReadOnly Property CurrentNode As SiteMapNode 'Usage Dim instance As SiteMapProvider Dim value As SiteMapNode value = instance.CurrentNode
/** @property */ public SiteMapNode get_CurrentNode ()
public function get CurrentNode () : SiteMapNode
Not applicable.
Property Value
A SiteMapNode that represents the currently requested page; otherwise, a null reference (Nothing in Visual Basic), if the SiteMapNode is not found or cannot be returned for the current user.The SiteMapResolve event is raised before attempting to retrieve a SiteMapNode object, to enable event subscribers to return an instance of the SiteMapNode class. If there are no event subscribers, the SiteMapProvider class calls the FindSiteMapNode method using the current HTTP context to retrieve a SiteMapNode that represents the currently requested page.
If the currently requested page does not correspond with a SiteMapNode, a null reference (Nothing in Visual Basic) is returned. If security trimming is enabled and the user is not permitted to access the SiteMapNode, a null reference (Nothing in Visual Basic) is returned.
| Topic | Location |
|---|---|
| How to: Programmatically Modify Site-Map Nodes in Memory | Building ASP .NET Web Applications |
| How to: Programmatically Modify Site-Map Nodes in Memory | Building ASP .NET Web Applications |
The following code example demonstrates how to implement the CurrentNode property in a class that implements the abstract SiteMapProvider class.
This code example is part of a larger example provided for the SiteMapProvider class.
' 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