MvcSiteMapProvider preserved路线参数给出错误"无法解析的网址站点地图节点QUOT; [英] MvcSiteMapProvider preserved route parameter gives error "Could not resolve URL for sitemap node"

查看:142
本文介绍了MvcSiteMapProvider preserved路线参数给出错误"无法解析的网址站点地图节点QUOT;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MVC网站地图提供商创建菜单在.net MVC3项目。

I am working on a project in .Net MVC3 using MVC SiteMap Provider for creating the menus.

有些菜单节点应该是可见的,只有当特定路由参数(meetingId)设置,见下面的例子:

Some of the menu nodes should be visible only when a specific route parameter (meetingId) is set, see example below:

<mvcSiteMapNode controller="MeetingAttendants" action="Index" title="Attendants" preservedRouteParameters="meetingId" />

该meetingId参数是一个不可为空的整型,有没有默认值。浏览有关会议的信息时,参数设置。

The meetingId parameter is a non-nullable int, that has no default value. The parameter is set when browsing information about a meeting.

在加载其中参数没有设置页面,则会引发错误:

When loading a page where the parameter is not set, an error is thrown:

无法解析的网址站点地图结点服务员从而重新presents行动指数控制器MeetingAttendants。确保此站点地图节点的路由就可以解决,而且其默认值允许解析URL当前站点地图节点。

Could not resolve URL for sitemap node Attendants which represents action Index in controller MeetingAttendants. Ensure that the route for this sitemap node can be resolved and that its default values allow resolving the URL for the current sitemap node.

我曾尝试绘制路线时设置的默认值,这使得问题消失。不过反正是有没有设置默认值(应该没有默认值)来解决这个问题呢?

I have tried setting a default value when mapping the routes, and that makes the problem go away. But is there anyway to solve this problem without setting a default value (as there should be no default value)?

推荐答案

我不确定为什么解析器的缺省实现的行为这种方式。看看我的这个问题 - 以及使用一个小的变化,以自己的SiteMapNodeUrlResolver(因为它似乎你没有)

I am unsure why the default implementation of the resolver behaves this way. Have a look at my issue about this - as well as an easy fix using a small change to your own SiteMapNodeUrlResolver (as it seems you did).

希望能得到一些反馈,并可能获得默认这种改变?

Hoping to get some feedback and maybe get this changed in the defaults?

https://github.com/maartenba/MvcSiteMapProvider/issues/115

这篇关于MvcSiteMapProvider preserved路线参数给出错误&QUOT;无法解析的网址站点地图节点QUOT;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆