为什么 Orchard 会自动将字符串编码到视图中?
在我的驱动程序中,我将动态对象传递给视图,但它会自动编码所有字符串,这会破坏我在视图中构造的链接。
这就是我想要做的:
public class SomeWidgetDriver : ContentPartDriver<SomeWidgetPart>
{
// GET
protected override DriverResult Display(SomeWidgetPart part, string displayType, dynamic shapeHelper)
{
return ContentShape("Parts_SomeWidget",
() => shapeHelper.Parts_SomeWidget(
AppUrl: part.AppUrl,
AppVersion: part.AppVersion,
RenderTo: part.RenderTo,
Test: "xxxx&"));
}
}
当我将以下内容添加到视图中时:
@Model.Test
它呈现如下:
xxxx&
有没有办法阻止这种情况发生?我试图让它准确地渲染“xxxx&”。
In my driver, I am passing the dynamic object to the view, but it is automatically encoding all my strings which is mangling the links I am constructing in the view.
Here is what I am trying to do:
public class SomeWidgetDriver : ContentPartDriver<SomeWidgetPart>
{
// GET
protected override DriverResult Display(SomeWidgetPart part, string displayType, dynamic shapeHelper)
{
return ContentShape("Parts_SomeWidget",
() => shapeHelper.Parts_SomeWidget(
AppUrl: part.AppUrl,
AppVersion: part.AppVersion,
RenderTo: part.RenderTo,
Test: "xxxx&"));
}
}
When I add the below to the view:
@Model.Test
It renders like this:
xxxx&
Is there a way to stop this from happening? I am trying to get it to exactly render "xxxx&".
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为这与果园根本没有关系。
在 Razor 中,一切都是 html 编码的。
你尝试过吗:
?
I don't think this has to do with Orchard at all.
In Razor everything is html encoded.
Did you try:
?