gpt4 book ai didi

c# - 为什么 Orchard 会自动将字符串编码到 View 中?

转载 作者:行者123 更新时间:2023-12-02 15:04:20 26 4
gpt4 key购买 nike

在我的驱动程序中,我将动态对象传递给 View ,但它会自动编码所有字符串,这会破坏我在 View 中构造的链接。

这是我正在尝试做的事情:

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&"));
}
}

当我将以下内容添加到 View 中时:

@Model.Test

它的渲染效果如下:

xxxx&amp;

有办法阻止这种情况发生吗?我试图让它准确渲染“xxxx&”。

最佳答案

我认为这与 Orchard 完全无关。在 Razor 中,一切都是 html 编码的。你尝试过吗:

@Html.Raw(Model.Test)

关于c# - 为什么 Orchard 会自动将字符串编码到 View 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8843688/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com