Export (0) Print
Expand All

StaticSiteMapProvider.BuildSiteMap Method

When overridden in a derived class, loads the site map information from persistent storage and builds it in memory.

Namespace:  System.Web
Assembly:  System.Web (in System.Web.dll)

abstract BuildSiteMap : unit -> SiteMapNode

Return Value

Type: System.Web.SiteMapNode
The root SiteMapNode of the site map navigation structure.

The BuildSiteMap method is the one abstract member of the StaticSiteMapProvider class. The BuildSiteMap method is called to load and build the site map node from persistent storage. When you implement the BuildSiteMap method, ensure that it is thread-safe, because multiple concurrent page requests can result indirectly in multiple calls to load site map information.

Notes to Inheritors

When overriding the BuildSiteMap method in a derived class, be sure to normalize the URLs of SiteMapNode objects that you add to your site map provider, so that the FindSiteMapNode method can retrieve a site map node regardless of whether the URL for the site map node is supplied as an absolute virtual path or application relative path. Site map provider implementers using the AddNode method should normalize any URLs before storing SiteMapNode objects in the internal hash tables on behalf of the site map provider.

Security trimming behavior is included in the SiteMapProvider and StaticSiteMapProvider class implementations. However, for security trimming to function in derived classes, you must set the Roles property of any SiteMapNode objects that you create while building a site map provider when you override the BuildSiteMap method.

Important noteImportant

The BuildSiteMap method is called by the default implementation of the FindSiteMapNode, GetChildNodes, and GetParentNode methods. If you override the BuildSiteMap method in a derived class, ensure that it loads site map data only once and returns on subsequent calls.

The following code example demonstrates how to implement the BuildSiteMap method to retrieve data from a Microsoft Access database and build SiteMapNode objects that are added to the ChildNodes collection of the root site map node. Finally, the RootNode property is returned to the caller.

This code example is part of a larger example provided for the StaticSiteMapProvider class.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.5, 4, 3.5, 3.0, 2.0

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft