开发者

telerik mvc sitemap performance

I'm using telerik's MVC extensions to bind a sitemap like demonstrated on their demos page: http://demos.telerik.com/aspnet-mvc/panelbar/sitemapbinding

But when rendering the sitemap with the following code it takes about 6 seconds

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%
    Html.Telerik().PanelBar()
       .Name("SiteMapPanelBar")
       .BindTo("sitemap")
       .Render();
%>

(the same problem exists with TreeView instead of PanelBar)

The Action Method itself executes fast

public partial class NavigationController : Controller
{
    public const string SiteMapFile = "~/Web.sitemap";
    public const string SiteMapName = "siteMap";
    public const string SiteMapKey = "siteMap";

    [PopulateSiteMap(SiteMapName = SiteMapName, ViewDataKey = SiteMap开发者_开发技巧Key)]
    public virtual ActionResult SiteMap()
    {
        if (!SiteMapManager.SiteMaps.ContainsKey(SiteMapKey))
        {
            SiteMapManager.SiteMaps.Register<XmlSiteMap>(SiteMapKey, sitmap => sitmap.LoadFrom(SiteMapFile));
        }

        return View();
    }
}

Has someone encountered the same problem and/or knows what the problem could be and how to solve it?

Thanks


Here is a quote of the answer in the posted forum thread:

After further investigation it looks out that Spring.Web.Mvc.dll is the issue. In this case PanelBar UI component will check for each node and its children if they are accessible. Thus "Security trimming" feature works in this case. IsAccessible() method will get all controllers and action attributes in order to check item accessibility. You probably guessed already that combination of application in Debug mode and reference to the Spring.Web.Mvc.dll will cause this performance issue, because retrieved attributes are not cached. If you need to better performance I will suggest you test in release mode. Nevertheless we will further investigate this issue and will try to find better solution for this problem. Probably will always cache controllers attributes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜