相关疑难解决方法(0)

根据用户角色将XML站点地图加载到MvcSiteMapProvider中

我已经安装了MvcSiteMapProvider的v4,现在我想动态加载站点地图.我的需求很简单 - 根据当前登录的用户角色在每个页面请求上加载XML站点地图,例如.AdminSiteMap.xml和UserSiteMap.xml

看来这可以做到:

所以基本上你需要使用DI来实现这个目标(矫枉过正恕我直言).没有 DI 可以做到这一点吗?

因此,当我使用ASP Boilerplate(http://www.aspnetboilerplate.com/)时,我将Castle Windsor作为我的DI.

所以我通过NuGet安装了"MvcSiteMapProvider MVC5 Windsor依赖注入配置".但是现在当我运行应用程序时,我收到以下错误:

SiteMapLoader尚未初始化.

Check the 'MvcSiteMapProvider_UseExternalDIContainer' setting in the AppSettings section of web.config.

If the setting is set to 'false', you will need to call the MvcSiteMapProvider.DI.Composer.Compose() method at the end of Application_Start in the Global.asax file. Alternatively, if you are using .NET 4.0 or higher you can install the MvcSiteMapProvider.MVCx NuGet package corresponding to your MVC version.

If the …
Run Code Online (Sandbox Code Playgroud)

c# asp.net mvcsitemapprovider

3
推荐指数
1
解决办法
2903
查看次数

标签 统计

asp.net ×1

c# ×1

mvcsitemapprovider ×1