MonoRail 重定向到 # 锚点
我正在使用 Castle Monorail 和 jQuery 选项卡式导航。
处理控制器操作时,我想重定向到视图,并控制哪个选项卡可见。 因此,我想让我的控制器重定向到视图中的特定锚点,大致如下:
RedirectToAction("Edit", "id=1", "#roles"));
生成 url:
http://localhost/MyApp/User/edit.rails?id=1#roles
但是,实际结果将 # 符号编码为 %23
http://localhost/MyApp/User/edit.rails?id=1&%23roles=&
我肯定缺少一个基本概念。 我需要做什么来解决这个问题?
I'm using Castle Monorail with jQuery tabbed navigation.
When handling a controller action, I would like to redirect to a view, and control which tab is visible. Therefore, I'd like to have my controller redirecting to a specific anchor in a view, something along the lines of:
RedirectToAction("Edit", "id=1", "#roles"));
Resulting in the url:
http://localhost/MyApp/User/edit.rails?id=1#roles
However, the actual result encodes the # sign to %23
http://localhost/MyApp/User/edit.rails?id=1&%23roles=&
I'm surely missing a basic concept here. What do I need to do to solve this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它不仅对“#”符号进行编码,它只是将其引用为另一个查询字符串参数(添加“&”和“=”)
我建议您将此问题发布到 Castle 项目的用户组,甚至更好 - 在 Castle 的问题跟踪器。
It does not only encode the '#' sign, it simply refer to it as another query string parameter (adds '&' and '=')
I'd advise you to post this question to the users group of Castle Project, and even better - open issue on Castle's issue tracker.
不是最好的解决方案,但我使用了 RedirectToUrl() 并使用了静态 url。
另一种解决方案是使用路由引擎并自己创建 url,然后添加实际的哈希值。
检查
RoutingModuleEx.Engine.CreateUrl()
或类似的东西。
Not the best solution, but I used RedirectToUrl() and used a static url.
Another solution would be to use the Routing-engine and create the url yourself, and then add the actual hash.
check
RoutingModuleEx.Engine.CreateUrl()
Or something like that.