首页 > 解决方案 > C# 返回 " 而不是 "

问题描述

我的代码正在返回"而不是"

在 .cs

public string openingVal
{
    get
    {
        string opening = "";
        opening += "\"openingHoursSpecification\": [";
        opening += "{";
        opening += "\"@type\": \"OpeningHoursSpecification\",";
        opening += "\"dayOfWeek\": [";
        opening += "\"Tuesday\",";
        opening += "\"Wednesday\",";
        opening += "\"Thursday\",";
        opening += "\"Friday\",";
        opening += "\"Saturday\"";
        opening += "],";
        opening += "\"opens\": \"09:00\",";
        opening += "\"closes\": \"19:00\"";
        opening += "}";
        opening += "],";

        return HttpUtility.HtmlDecode(opening);
    }
}

在 .aspx 中

<%:addressOpening.openingVal.Replace("quot;","\"") %>

然后返回

&quot;openingHoursSpecification&quot;: [{&quot;@type&quot;: &quot;OpeningHoursSpecification&quot;,&quot;dayOfWeek&quot;: [&quot;Tuesday&quot;,&quot;Wednesday&quot;,&quot;Thursday&quot;,&quot;Friday&quot;,&quot;Saturday&quot;],&quot;opens&quot;: &quot;09:00&quot;,&quot;closes&quot;: &quot;19:00&quot;}],

我尝试了 HtmlDecode Utility,也使用了 Replace。两者都不做。

我失去理智了吗?

标签: asp.net

解决方案


推荐阅读