PortalSiteMapProvider.TryGetCurrentNode property

Gets a PortalSiteMapNode object that represents the item that a site user is currently visiting.

Namespace:  Microsoft.SharePoint.Publishing.Navigation
Assembly:  Microsoft.SharePoint.Publishing (in Microsoft.SharePoint.Publishing.dll)

Syntax

'Declaration
Public ReadOnly Property TryGetCurrentNode As SiteMapNode
    Get
'Usage
Dim instance As PortalSiteMapProvider
Dim value As SiteMapNode

value = instance.TryGetCurrentNode
public SiteMapNode TryGetCurrentNode { get; }

Property value

Type: System.Web.SiteMapNode
A PortalSiteMapNode object that represents the current item being visited, if one exists and the operation is inexpensive; otherwise, a null reference (Nothing in Visual Basic).

Remarks

This property only gets the PortalSiteMapNode object if it would be an inexpensive operation.

For better performance, the CurrentNode property only avoids database queries by reading its data from a cache. However, if the object cannot be found in the cache, then a database query will still occur, which may be undesirable.

The TryGetCurrentNode property guarantees that these database queries cannot occur by instead returning a null reference (Nothing in Visual Basic) if the required objects were not already loaded into the cache. This is useful for nonessential operations that should only be performed if this can be done cheaply.

See also

Reference

PortalSiteMapProvider class

PortalSiteMapProvider members

Microsoft.SharePoint.Publishing.Navigation namespace